Interface DateField<F extends DateField<F>>

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

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.