public interface Property<T> extends Validator.Validatable<T>, Localizable, HasConfiguration<PropertyConfiguration>, ConverterExpression<T>, Serializable
getType() method and it is generalized on such type.
A property can be identified by a symbolic name, which can be obtained through the getName() method.
Supports a PropertyValueConverter to be used within a PropertyBox abstraction when property is bound
to a data model, allowing property value conversion in both directions when property value type and data model value
type does not match.
A property brings with it a generic PropertyConfiguration structure, organized as a parameter set, which can
be used to set custom configuration attributes.
This property is Validator.Validatable, supporting property value Validators.
Extends Localizable to optionally provide a localizable message which describes the property.
The property equals and hashCode logic can be customized using suitable
EqualsHandler and HashCodeProvider functions. See Property.Builder.equalsHandler(EqualsHandler) and
Property.Builder.hashCodeProvider(HashCodeProvider) methods for further details.
PathProperty,
VirtualProperty,
PropertySet,
PropertyBox| Modifier and Type | Interface and Description |
|---|---|
static interface |
Property.Builder<T,P extends Property<T>,B extends Property.Builder<T,P,B>>
Base
Property builder. |
static class |
Property.PropertyAccessException
Base exception class to all
Property related exceptions. |
static class |
Property.PropertyNotFoundException
Exception thrown when a property is not found in a property set.
|
static class |
Property.PropertyReadException
Generic exception thrown for property value reading failures.
|
static class |
Property.PropertyReadOnlyException
Exception thrown when trying to set a value for a read-only property.
|
static class |
Property.PropertyWriteException
Generic exception thrown for property value writing failures.
|
Localizable.LocalizableBuilder, Localizable.LocalizationExceptionExpression.ExpressionResolverFunction<E extends Expression,R extends Expression>, Expression.InvalidExpressionException| Modifier and Type | Method and Description |
|---|---|
PropertyConfiguration |
getConfiguration()
Gets the configuration associated to this property.
|
default Object |
getConvertedValue(T value)
Return the given
value against this property, converting it to required model data type if a
PropertyValueConverter is present. |
Optional<PropertyValueConverter<T,?>> |
getConverter()
Get the converter to perform property value conversions between property value and the corresponding data model
value.
|
default Optional<ExpressionValueConverter<T,?>> |
getExpressionValueConverter()
Get the expression value type converter, if available.
|
String |
getName()
Get the name which identifies this property.
|
default Optional<TemporalType> |
getTemporalType()
If the expression type represents a temporal type, get the actual
TemporalType of the type. |
Class<? extends T> |
getType()
Get the type of values supported by this property.
|
boolean |
isReadOnly()
Gets whether property is read-only, i.e.
|
default String |
present(T value)
Present given property
value as a String, using current
PropertyValuePresenterRegistry if available as Context resource or the default instance
otherwise. |
default <R> R |
render(Class<R> renderType)
Render this property as given
renderType. |
default <R> Optional<R> |
renderIfAvailable(Class<R> renderType)
Render this property as given
renderType if a suitable PropertyRenderer for given rendering
type is available from the PropertyRendererRegistry obtained from current Context or from the
default one for current ClassLoader. |
getValidators, validatebuilder, getMessage, getMessageArguments, getMessageCode, of, ofhasConfigurationgetModelType, getModelValueisCollectionExpression, isConverterExpressionvalidateString getName()
Class<? extends T> getType()
getType in interface TypedExpression<T>boolean isReadOnly()
When a property is read-only, a Property.PropertyReadOnlyException should be thrown by property value setting
methods.
true if property is read-onlyPropertyConfiguration getConfiguration()
This configuration is considered as immutable: it only provides methods to read configuration parameters. The
configuration parameters setting is done at property creation time, using the
Property.Builder.configuration(String, Object) and Property.Builder.configuration(ConfigProperty, Object) methods
provided by Property Property.Builder.
getConfiguration in interface HasConfiguration<PropertyConfiguration>PropertyConfiguration of this property (immutable and not null)default Optional<TemporalType> getTemporalType()
TypedExpressionTemporalType of the type.getTemporalType in interface TypedExpression<T>Optional<PropertyValueConverter<T,?>> getConverter()
PropertyValueConverter is supported out-of-the-box when property value is handled using a
PropertyBox.default Object getConvertedValue(T value)
value against this property, converting it to required model data type if a
PropertyValueConverter is present.value - Property value (can be null)PropertyValueConverterdefault Optional<ExpressionValueConverter<T,?>> getExpressionValueConverter()
ConverterExpressiongetExpressionValueConverter in interface ConverterExpression<T>ExpressionValueConverterdefault String present(T value)
value as a String, using current
PropertyValuePresenterRegistry if available as Context resource or the default instance
otherwise. If a PropertyValuePresenter is not available from registry, simple Object.toString()
representation of the value is returned.value - Value to present as a Stringvaluedefault <R> R render(Class<R> renderType)
renderType.
To successfully render the property, a suitable PropertyRenderer for given render type must be available
from the PropertyRendererRegistry obtained from current Context or from the default one for
current ClassLoader.
R - Rendered object typerenderType - Render typePropertyRendererRegistry.NoSuitableRendererAvailableException - if no PropertyRenderer is available for this property and given
rendering typedefault <R> Optional<R> renderIfAvailable(Class<R> renderType)
renderType if a suitable PropertyRenderer for given rendering
type is available from the PropertyRendererRegistry obtained from current Context or from the
default one for current ClassLoader.R - Rendered object typerenderType - Render typeCopyright © 2019 The Holon Platform. All rights reserved.