- java.lang.Object
-
- io.github.mmm.property.AbstractPropertyMetadata<V>
-
- io.github.mmm.property.PropertyMetadataType<V>
-
- Type Parameters:
V
- type of theproperty value
.
- All Implemented Interfaces:
PropertyMetadata<V>
- Direct Known Subclasses:
BeanPropertyMetadataType
public class PropertyMetadataType<V> extends AbstractPropertyMetadata<V>
Implementation ofPropertyMetadata
as immutable type.- Since:
- 1.0.0
-
-
Field Summary
Fields Modifier and Type Field Description protected Supplier<? extends V>
expression
-
Constructor Summary
Constructors Constructor Description PropertyMetadataType(Validator<? super V> validator)
The constructor.PropertyMetadataType(Validator<? super V> validator, Supplier<? extends V> expression, Object[] metadataValues)
The constructor.PropertyMetadataType(Validator<? super V> validator, Supplier<? extends V> expression, Type valueType, Map<String,Object> metadata)
The constructor.PropertyMetadataType(Supplier<? extends V> expression)
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>
asMap()
Supplier<? extends V>
getExpression()
Validator<? super V>
getValidator()
Type
getValueType()
PropertyMetadata<V>
withValidator(Validator<? super V> newValidator)
-
Methods inherited from class io.github.mmm.property.AbstractPropertyMetadata
get, getKeyCount, getKeys
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.github.mmm.property.PropertyMetadata
get, get, getMarshalling, hasKeys, isTransient
-
-
-
-
Field Detail
-
expression
protected Supplier<? extends V> expression
- See Also:
getExpression()
-
-
Constructor Detail
-
PropertyMetadataType
public PropertyMetadataType(Validator<? super V> validator)
The constructor.- Parameters:
validator
- thevalidator
.
-
PropertyMetadataType
public PropertyMetadataType(Supplier<? extends V> expression)
The constructor.- Parameters:
expression
- theexpression
.
-
PropertyMetadataType
public PropertyMetadataType(Validator<? super V> validator, Supplier<? extends V> expression, Object[] metadataValues)
The constructor.- Parameters:
validator
- thevalidator
.expression
- theexpression
.metadataValues
- themetadata values
. Should only be specific types such asAnnotation
s-
-
-
Method Detail
-
getValidator
public Validator<? super V> getValidator()
- Specified by:
getValidator
in interfacePropertyMetadata<V>
- Overrides:
getValidator
in classAbstractPropertyMetadata<V>
- Returns:
- the
Validator
used tovalidate
the property.
-
getExpression
public Supplier<? extends V> getExpression()
- Specified by:
getExpression
in interfacePropertyMetadata<V>
- Overrides:
getExpression
in classAbstractPropertyMetadata<V>
- Returns:
- the optional
Supplier
that calculates thevalue
dynamically. May benull
for a regular property. If it is notnull
the property will automatically beread-only
. You should not provide an explicitvalidator
if you provide an expression.
-
getValueType
public Type getValueType()
- Specified by:
getValueType
in interfacePropertyMetadata<V>
- Overrides:
getValueType
in classAbstractPropertyMetadata<V>
- Returns:
- the optional
Type
of theproperty value
. May benull
. - See Also:
ReadableTypedValue.getValueClass()
-
asMap
public Map<String,Object> asMap()
- Specified by:
asMap
in interfacePropertyMetadata<V>
- Overrides:
asMap
in classAbstractPropertyMetadata<V>
- Returns:
- a new or immutable
Map
with this metadatakey
/value
pairs.
-
withValidator
public PropertyMetadata<V> withValidator(Validator<? super V> newValidator)
- Parameters:
newValidator
- the newValidator
.- Returns:
- a new instance of
PropertyMetadata
with the givenValidator
used forPropertyMetadata.getValidator()
.
-
-