Record Class FormatConfiguration

java.lang.Object
java.lang.Record
io.micronaut.serde.FormatConfiguration
Record Components:
pattern - The format pattern
shape - The shape to use
locale - The locale to use
timezone - The time zone to use
lenient - Whether lenient parsing should be used
radix - The numeric base to use

public record FormatConfiguration(@Nullable String pattern, FormatConfiguration.Shape shape, @Nullable String locale, @Nullable String timezone, @Nullable Boolean lenient, int radix) extends Record
Configuration mapped from format metadata.
Since:
3.0
Author:
Denis Stepanov
  • Field Details

  • Constructor Details

  • Method Details

    • from

      public static @Nullable FormatConfiguration from(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
      Resolve format configuration from annotation metadata.
      Parameters:
      annotationMetadata - The annotation metadata
      Returns:
      The format configuration
    • parseLocale

      public @Nullable Locale parseLocale()
      Returns:
      The parsed locale, or null if no locale is configured
    • parseTimeZone

      public TimeZone parseTimeZone()
      Returns:
      The parsed time zone, defaulting to UTC if no time zone is configured
    • createDateFormat

      public Optional<SimpleDateFormat> createDateFormat()
      Returns:
      A date format when a pattern is configured
    • createDateTimeFormatter

      public Optional<DateTimeFormatter> createDateTimeFormatter()
      Returns:
      A date-time formatter when a pattern is configured
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • pattern

      public @Nullable String pattern()
      Returns the value of the pattern record component.
      Returns:
      the value of the pattern record component
    • shape

      public FormatConfiguration.Shape shape()
      Returns the value of the shape record component.
      Returns:
      the value of the shape record component
    • locale

      public @Nullable String locale()
      Returns the value of the locale record component.
      Returns:
      the value of the locale record component
    • timezone

      public @Nullable String timezone()
      Returns the value of the timezone record component.
      Returns:
      the value of the timezone record component
    • lenient

      public @Nullable Boolean lenient()
      Returns the value of the lenient record component.
      Returns:
      the value of the lenient record component
    • radix

      public int radix()
      Returns the value of the radix record component.
      Returns:
      the value of the radix record component