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)
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
DateField.Attributes
static class
DateField.DateStartUnit
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default F
dateFormat(String format)
Adds theDateField.Attributes.DATE_FORMAT
attribute.default F
defaultEndOf(DateField.DateStartUnit endUnit)
Use the current date default ending at the particular unit.default F
defaultNow()
Represents a default value for a date set to the exact moment it is generated on the frontenddefault F
defaultStartOf(DateField.DateStartUnit startUnit)
Use the current date default starting at the particular unit.default Optional<String>
findDateFormat()
Finds theDateColumn.Attributes.DATE_FORMAT
attribute.default String
getDateFormat()
Gets theDateField.Attributes.DATE_FORMAT
attribute.default boolean
hasDateFormat()
Checks whether theDateField.Attributes.DATE_FORMAT
attribute has been set.default F
removeDateFormat()
Removes theDateField.Attributes.DATE_FORMAT
attribute.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.-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface com.broadleafcommerce.metadata.dsl.core.Component
addAction, addAction, addComponent, addEndpoint, addEndpoint, apply, attribute, augmentationKey, classifier, clearConditionals, clearEndpoints, conditional, conditionals, description, description, findAction, findAction, findActions, findAttribute, findComponent, findComponent, findComponents, findEndpoint, findEndpoint, findEndpoints, get, get, getAction, getAction, getActions, getActionsList, getAttribute, getAttribute, getAttributes, getAugmentationKey, getClassifier, getComponent, getComponent, getComponents, getComponentsList, getConditionals, getDescription, getEndpoint, getEndpoint, getEndpoints, getEndpointsList, getId, getLabel, getOrder, getScope, getType, hasAction, hasAttribute, hasComponent, hasEndpoint, id, isAugmentable, isTranslatable, label, label, notTranslatable, order, removeAction, removeAttribute, removeComponent, removeEndpoint, scope, self, setActions, setAttributes, setAugmentationKey, setClassifier, setComponents, setConditionals, setDescription, setEndpoints, setId, setLabel, setOrder, setScope, setTranslatable, setType, translatable, translatable, type
-
Methods inherited from interface com.broadleafcommerce.metadata.dsl.core.Field
clearReadOnlyConditionals, decorated, defaultValue, getDefaultValue, getName, getPlaceholder, getReadOnlyConditionals, getRequiredMessage, getValidationSchema, isReadOnly, isRequired, isShowInQueryBuilder, isTargetCollection, name, notReadOnly, notRequired, placeholder, placeholder, readOnly, readOnly, readOnlyConditional, readOnlyConditionals, required, required, required, required, requiredMessage, requiredMessage, setDefaultValue, setName, setPlaceholder, setReadOnly, setReadOnlyConditionals, setRequired, setRequiredMessage, setShowInQueryBuilder, setValidationSchema, targetIsCollection, targetIsNotCollection, validationMethod, validationSchema, validationSchema
-
Methods inherited from interface com.broadleafcommerce.metadata.dsl.core.FormComponent
getHelpText, getHint, getTooltip, helpText, helpText, hidden, hidden, hint, hint, isHidden, notHidden, setHelpText, setHidden, setHint, setTooltip, tooltip, tooltip
-
-
-
-
Method Detail
-
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:00defaultStartOf(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:59defaultEndOf(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 errorarg
- the arguments for the validation method- Returns:
- this field for further customization
-
dateFormat
default F dateFormat(String format)
Adds theDateField.Attributes.DATE_FORMAT
attribute.- Parameters:
format
- The format to set. SeeDateFormatTypes
- Returns:
this
-
getDateFormat
@Nullable default String getDateFormat()
Gets theDateField.Attributes.DATE_FORMAT
attribute.- Returns:
- the value of the attribute
-
findDateFormat
default Optional<String> findDateFormat()
Finds theDateColumn.Attributes.DATE_FORMAT
attribute.- Returns:
- the value of the attribute or
Optional.empty()
if not present.
-
removeDateFormat
default F removeDateFormat()
Removes theDateField.Attributes.DATE_FORMAT
attribute.- Returns:
this
-
hasDateFormat
default boolean hasDateFormat()
Checks whether theDateField.Attributes.DATE_FORMAT
attribute has been set.- Returns:
- Whether the attribute is set.
-
-