Interface DerivedField<F extends DerivedField<F>>
- All Superinterfaces:
Comparable<F>,Component<F>,Copyable<F>,Field<F>,FormComponent<F>,Serializable
- All Known Implementing Classes:
DefaultDerivedField
FieldTypes.DERIVED field component. These fields derive
their values from that of other fields. The values can also be transformed into a different case
if it's a string. The default field type is FieldTypes.STRING.
By default, the values will only be derived if undefined—not if the field has a value including
null. However, this can be changed be setting persist() to false. In this case, the
derived value will not be persisted but only displayed. When this is the case, null is treated
the same as undefined since Java does not distinguish between them.
The default transformation type for strings is "camel", which means the original value wil be
transformed to came-case: camelCase. Use kebab(), snake(), etc. to do a
different transformation, or use none() to perform no transformation.
- Author:
- Jon Fleschler (jfleschler)
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classstatic final class -
Method Summary
Modifier and TypeMethodDescriptiondefault Fcamel()Indicates that the source value will be transformed to camel case:someValue.default FIndicates that the source value will be transformed so that only the first character is capitalized:Some value.default FSet the type of field to render such as STRING or INTEGER.default Fkebab()Indicates that the source value will be transformed to kebab case:some-value.default Flower()Indicates that the source value will be transformed to lower case:some value.default Fnone()Indicates that no transformation of the source will occur.default Fpascal()Indicates that the source value will be transformed to pascal case:SomeValue.default Fpersist()Whether the derived value should be persisted or merely displayed.default Fpersist(boolean persist) default Fdefault Fdefault Fdefault Fdefault Fsnake()Indicates that the source value will be transformed to snake case:some_value.default FThe source field on the entity.default FIndicates that the source value will be transformed to start case:Some Value.default FSet the transformation type.default Fupper()Indicates that the source value will be transformed to upper case:SOME VALUE.Methods inherited from interface java.lang.Comparable
compareToMethods 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, findAttribute, findComponent, findComponent, findComponents, findEndpoint, 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, translatableMethods inherited from interface com.broadleafcommerce.metadata.dsl.core.Field
clearReadOnlyConditionals, decorated, 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, validationSchemaMethods inherited from interface com.broadleafcommerce.metadata.dsl.core.FormComponent
getHelpText, getHint, getTooltip, helpText, helpText, helpText, hidden, hidden, hint, hint, isHidden, notHidden, setHelpText, setHidden, setHint, setTooltip, tooltip, tooltip
-
Method Details
-
source
The source field on the entity. Use$parentto reference a field on the parent entity. -
fieldType
Set the type of field to render such as STRING or INTEGER. -
kebab
Indicates that the source value will be transformed to kebab case:some-value. -
camel
Indicates that the source value will be transformed to camel case:someValue.This is the default value.
-
snake
Indicates that the source value will be transformed to snake case:some_value. -
pascal
Indicates that the source value will be transformed to pascal case:SomeValue. -
upper
Indicates that the source value will be transformed to upper case:SOME VALUE. -
lower
Indicates that the source value will be transformed to lower case:some value. -
capitalize
Indicates that the source value will be transformed so that only the first character is capitalized:Some value. This is not the same as capital/title case or sentence case—those are too complicated to support. -
startCase
Indicates that the source value will be transformed to start case:Some Value. -
none
Indicates that no transformation of the source will occur. -
type
Set the transformation type. This only affects string fields.- Specified by:
typein interfaceComponent<F extends DerivedField<F>>- Parameters:
type- the type- Returns:
- this
-
persist
Whether the derived value should be persisted or merely displayed. This applies until the field is directly modified—once modified the value is always persisted regardless of this flag. Default is true.Since the backend is using Java, the value will be nulled if this is false. To make up for this, null values will be treated the same as undefined by the frontend when this is false.
-
persist
- See Also:
-
removePersist
-
removeType
-
removeFieldType
-
removeSource
-