Class FormatCache<F extends Format>

java.lang.Object
org.miaixz.bus.core.center.date.format.FormatCache<F>

public abstract class FormatCache<F extends Format> extends Object
日期格式化器缓存
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • FormatCache

      public FormatCache()
  • Method Details

    • getInstance

      public F getInstance()
      使用默认的pattern、timezone和locale获得缓存中的实例
      Returns:
      a date/time format
    • getInstance

      public F getInstance(String pattern, TimeZone timeZone, Locale locale)
      使用 pattern, time zone and locale 获得对应的 格式化器
      Parameters:
      pattern - 非空日期格式,使用与 SimpleDateFormat相同格式
      timeZone - 时区,默认当前时区
      locale - 地区,默认使用当前地区
      Returns:
      格式化器
      Throws:
      IllegalArgumentException - pattern 无效或null
    • createInstance

      protected abstract F createInstance(String pattern, TimeZone timeZone, Locale locale)
      创建格式化器
      Parameters:
      pattern - 非空日期格式,使用与 SimpleDateFormat相同格式
      timeZone - 时区,默认当前时区
      locale - 地区,默认使用当前地区
      Returns:
      格式化器
      Throws:
      IllegalArgumentException - pattern 无效或null