public interface Property<T> extends Validator.Validatable<T>, Localizable, Serializable
getType() method and it is generalized on such type.
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.
PathProperty,
VirtualProperty,
PropertySet,
PropertyBox| Modifier and Type | Interface and Description |
|---|---|
static interface |
Property.Builder<T,B extends Property.Builder<T,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.LocalizationException| 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.
|
Class<? extends T> |
getType()
Type of values supported by this property
|
boolean |
isReadOnly()
Gets whether property is read-only, i.e. does not support value setting.
|
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, getMessageCodeClass<? extends T> getType()
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, and only provide methods to read configuration parameters. The
configuration parameters setting is done at property creation time, using
Property.Builder.configuration(String, Object) and Property.Builder.configuration(ConfigProperty, Object) methods
provided by Property Property.Builder.
PropertyConfiguration of this property (immutable and not null)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 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 © 2017 The Holon Platform. All rights reserved.