类 DateMorpher

所有已实现的接口:
Morpher, ObjectMorpher

public final class DateMorpher extends AbstractObjectMorpher
Morphs a String to a Date.

This morpher will iterate through the supplied formats until one succeeds or the default value is returned (if default value is configured).

  • 构造器详细资料

    • DateMorpher

      public DateMorpher(String[] formats)
      参数:
      formats - a list of formats this morpher supports.
    • DateMorpher

      public DateMorpher(String[] formats, boolean lenient)
      参数:
      formats - a list of formats this morpher supports.
      lenient - if the parsing should be lenient or not.
    • DateMorpher

      public DateMorpher(String[] formats, Date defaultValue)
      参数:
      formats - a list of formats this morpher supports.
      defaultValue - return value if the value to be morphed is null.
    • DateMorpher

      public DateMorpher(String[] formats, Date defaultValue, Locale locale, boolean lenient)
      参数:
      formats - a list of formats this morpher supports.
      defaultValue - return value if the value to be morphed is null.
      locale - the Locale used to parse each format.
      lenient - if the parsing should be lenient or not.
    • DateMorpher

      public DateMorpher(String[] formats, Locale locale)
      参数:
      formats - a list of formats this morpher supports.
      locale - the Locale used to parse each format.
    • DateMorpher

      public DateMorpher(String[] formats, Locale locale, boolean lenient)
      参数:
      formats - a list of formats this morpher supports.
      locale - the Locale used to parse each format.
      lenient - if the parsing should be lenient or not.
  • 方法详细资料

    • equals

      public boolean equals(Object obj)
      覆盖:
      equals 在类中 Object
    • getDefaultValue

      public Date getDefaultValue()
      Returns the default value for this Morpher.
    • hashCode

      public int hashCode()
      覆盖:
      hashCode 在类中 Object
    • morph

      public Object morph(Object value)
      从接口复制的说明: ObjectMorpher
      Morphs the input object into an output object of the supported type.
      参数:
      value - The input value to be morphed
    • morphsTo

      public Class<?> morphsTo()
      从接口复制的说明: Morpher
      Returns the target Class for conversion.
      返回:
      the target Class for conversion.
    • setDefaultValue

      public void setDefaultValue(Date defaultValue)
      Sets the defaultValue to use if the value to be morphed is null.
      参数:
      defaultValue - return value if the value to be morphed is null
    • supports

      public boolean supports(Class<?> clazz)
      从类复制的说明: AbstractObjectMorpher
      Returns true if the Morpher supports conversion from this Class.
      Supports any type that is not an Array.
      指定者:
      supports 在接口中 Morpher
      覆盖:
      supports 在类中 AbstractObjectMorpher
      参数:
      clazz - the source Class
      返回:
      true if clazz is supported by this morpher, false otherwise.