T - Property typepublic interface VirtualProperty<T> extends Property<T>
Property which relies on a PropertyValueProvider to provide its value, and it is not
directly bound to a data model attribute.
By default, a VirtualProperty is always read-only.
The natural lifecycle of a VirtualProperty is within a PropertyBox instance. The PropertyBox
instance will be provided to the PropertyValueProvider when the value of a VirtualProperty is
requested through the PropertyBox.getValue(Property) method. This way, the values of other properties
contained in the PropertyBox can be used by the virtual property to calculate the value to provide.
The symbolic property name (made avaialable by Property.getName()) can be setted using the
VirtualProperty.Builder.name(String) method. If a specific name is not provided, the name of a virtual property will be a
default name composed by the class name and the instance hash code.
The create(Class) and create(Class, PropertyValueProvider) builder methods can be used to create
and configure a new PathProperty instance.
PropertyValueProvider| Modifier and Type | Interface and Description |
|---|---|
static interface |
VirtualProperty.Builder<T,P extends VirtualProperty<T>,B extends VirtualProperty.Builder<T,P,B>>
Base
VirtualProperty builder. |
static interface |
VirtualProperty.VirtualPropertyBuilder<T>
Default
VirtualProperty builder. |
Property.PropertyAccessException, Property.PropertyNotFoundException, Property.PropertyReadException, Property.PropertyReadOnlyException, Property.PropertyWriteExceptionLocalizable.LocalizableBuilder, Localizable.LocalizationExceptionExpression.ExpressionResolverFunction<E extends Expression,R extends Expression>, Expression.InvalidExpressionException| Modifier and Type | Method and Description |
|---|---|
static <T> VirtualProperty.VirtualPropertyBuilder<T> |
create(Class<? extends T> type)
Create a new VirtualProperty with given
type |
static <T> VirtualProperty.VirtualPropertyBuilder<T> |
create(Class<T> type,
PropertyValueProvider<T> valueProvider)
Create a new VirtualProperty with given
type using given PropertyValueProvider as property
value provider. |
PropertyValueProvider<T> |
getValueProvider()
Get property value provider.
|
default boolean |
isReadOnly()
Gets whether property is read-only, i.e. does not support value setting.
|
getConfiguration, getConvertedValue, getConverter, getExpressionValueConverter, getName, getTemporalType, getType, present, render, renderIfAvailablegetValidators, validatebuilder, getMessage, getMessageArguments, getMessageCode, of, ofhasConfigurationgetModelType, getModelValueisCollectionExpression, isConverterExpressionvalidatePropertyValueProvider<T> getValueProvider()
default boolean isReadOnly()
Property
When a property is read-only, a Property.PropertyReadOnlyException should be thrown by property value setting
methods.
isReadOnly in interface Property<T>true if property is read-onlystatic <T> VirtualProperty.VirtualPropertyBuilder<T> create(Class<? extends T> type)
typeT - Property value typetype - Property value typeVirtualProperty.Builder to setup property attributesstatic <T> VirtualProperty.VirtualPropertyBuilder<T> create(Class<T> type, PropertyValueProvider<T> valueProvider)
type using given PropertyValueProvider as property
value provider.T - Property value typetype - Property value typevalueProvider - Property value providerVirtualProperty.Builder to setup property attributesCopyright © 2019 The Holon Platform. All rights reserved.