Interface DateField<F extends DateField<F>>

All Superinterfaces:
Comparable<F>, Component<F>, Copyable<F>, Field<F>, FormComponent<F>, Serializable
All Known Subinterfaces:
DateRangeField<F>
All Known Implementing Classes:
DefaultDateField, DefaultDateRangeField

public interface DateField<F extends DateField<F>> extends Field<F>
Represents the metadata for a date picker field.
Author:
Dima Myroniuk (dmyroniuk)
  • Method Details

    • defaultNow

      default F defaultNow()
      Represents a default value for a date set to the exact moment it is generated on the frontend
      Returns:
      this field for further customization
    • defaultStartOf

      default F defaultStartOf(DateField.DateStartUnit startUnit)
      Use the current date default starting at the particular unit.
      • defaultStartOf(DateStartUnit.YEAR) = 2018-01-01 00:00:00
      • defaultStartOf(DateStartUnit.HOUR) = 2018-07-12 09:00:00
      Parameters:
      startUnit - the unit the default date should start at, never null
      Returns:
      this field for further customization
    • defaultEndOf

      default F defaultEndOf(DateField.DateStartUnit endUnit)
      Use the current date default ending at the particular unit. Examples of how the frontend will intepret certain values:
      • defaultEndOf(DateStartUnit.YEAR) = 2018-12-31 23:59:59
      • defaultEndOf(DateStartUnit.HOUR) = 2018-07-12 09:59:00
      Parameters:
      endUnit - the unit the default date should end, never null
      Returns:
      this field for further customization
    • validateIsAfter

      default F validateIsAfter(String messageKey, Object... arg)
      Creates a validation schema to verify that a date in this field is after a date in another field.
      Parameters:
      messageKey - the message key of the validation error
      arg - the arguments for the validation method
      Returns:
      this field for further customization
    • dateFormat

      default F dateFormat(String format)
      Parameters:
      format - The format to set. See DateFormatTypes
      Returns:
      this
    • getDateFormat

      @Nullable default String getDateFormat()
      Returns:
      the value of the attribute
    • findDateFormat

      default Optional<String> findDateFormat()
      Returns:
      the value of the attribute or Optional.empty() if not present.
    • removeDateFormat

      default F removeDateFormat()
      Removes the DateField.Attributes.DATE_FORMAT attribute.
      Returns:
      this
    • hasDateFormat

      default boolean hasDateFormat()
      Checks whether the DateField.Attributes.DATE_FORMAT attribute has been set.
      Returns:
      Whether the attribute is set.
    • computedFrom

      default F computedFrom(String dateField, String durationField, String durationUnit)
      Adds the DateField.Attributes.COMPUTED_FROM_DATE, DateField.Attributes.COMPUTED_FROM_DURATION, and DateField.Attributes.COMPUTED_FROM_DURATION_UNIT attributes. These attributes will only take effect if the field is readOnly.
      Parameters:
      dateField - the date field from which to dynamically compute the new date.
      durationField - the duration field from which to get the value to add to the date.
      durationUnit - the unit of the duration field.
      Returns:
      this
      Since:
      Metadata Service 2.0.8, Release Train 2.1.6, 2.2.2
    • hasComputedFromDate

      default boolean hasComputedFromDate()
      Checks whether the DateField.Attributes.COMPUTED_FROM_DATE attribute has been set.
      Returns:
      Whether the attribute is set.
      Since:
      Metadata Service 2.0.8, Release Train 2.1.6, 2.2.2
    • hasComputedFromDuration

      default boolean hasComputedFromDuration()
      Checks whether the DateField.Attributes.COMPUTED_FROM_DURATION attribute has been set.
      Returns:
      Whether the attribute is set.
      Since:
      Metadata Service 2.0.8, Release Train 2.1.6, 2.2.2
    • hasComputedFromDurationUnit

      default boolean hasComputedFromDurationUnit()
      Checks whether the DateField.Attributes.COMPUTED_FROM_DURATION_UNIT attribute has been set.
      Returns:
      Whether the attribute is set.
    • getComputedFromDate

      @Nullable default String getComputedFromDate()
      Returns:
      the value of the attribute
      Since:
      Metadata Service 2.0.8, Release Train 2.1.6, 2.2.2
    • getComputedFromDuration

      @Nullable default String getComputedFromDuration()
      Returns:
      the value of the attribute
      Since:
      Metadata Service 2.0.8, Release Train 2.1.6, 2.2.2
    • getComputedFromDurationUnit

      @Nullable default String getComputedFromDurationUnit()
      Returns:
      the value of the attribute
      Since:
      Metadata Service 2.0.8, Release Train 2.1.6, 2.2.2
    • removeComputedFrom

      default F removeComputedFrom()
      Returns:
      this
      Since:
      Metadata Service 2.0.8, Release Train 2.1.6, 2.2.2
    • isComputedFrom

      default boolean isComputedFrom()
      Returns:
      Whether the computed from attributes are set.
      Since:
      Metadata Service 2.0.8, Release Train 2.1.6, 2.2.2