- 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 ofPropertyMetadataas 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()TypegetValueType()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 asAnnotations-
-
-
Method Detail
-
getValidator
public Validator<? super V> getValidator()
- Specified by:
getValidatorin interfacePropertyMetadata<V>- Overrides:
getValidatorin classAbstractPropertyMetadata<V>- Returns:
- the
Validatorused tovalidatethe property.
-
getExpression
public Supplier<? extends V> getExpression()
- Specified by:
getExpressionin interfacePropertyMetadata<V>- Overrides:
getExpressionin classAbstractPropertyMetadata<V>- Returns:
- the optional
Supplierthat calculates thevaluedynamically. May benullfor a regular property. If it is notnullthe property will automatically beread-only. You should not provide an explicitvalidatorif you provide an expression.
-
getValueType
public Type getValueType()
- Specified by:
getValueTypein interfacePropertyMetadata<V>- Overrides:
getValueTypein classAbstractPropertyMetadata<V>- Returns:
- the optional
Typeof theproperty value. May benull. - See Also:
ReadableTypedValue.getValueClass()
-
asMap
public Map<String,Object> asMap()
- Specified by:
asMapin interfacePropertyMetadata<V>- Overrides:
asMapin classAbstractPropertyMetadata<V>- Returns:
- a new or immutable
Mapwith this metadatakey/valuepairs.
-
withValidator
public PropertyMetadata<V> withValidator(Validator<? super V> newValidator)
- Parameters:
newValidator- the newValidator.- Returns:
- a new instance of
PropertyMetadatawith the givenValidatorused forPropertyMetadata.getValidator().
-
-