Class Property<T,P>
- java.lang.Object
-
- org.vaadin.miki.superfields.object.Property<T,P>
-
- Type Parameters:
T- Object type.P- Property type.
public class Property<T,P> extends Object
Defines a property of an object.- Since:
- 2022-05-16
- Author:
- miki
-
-
Constructor Summary
Constructors Constructor Description Property(Class<T> owner, String name, Class<P> type, com.vaadin.flow.function.SerializableBiConsumer<T,P> setter, com.vaadin.flow.function.SerializableFunction<T,P> getter, Collection<PropertyMetadata> metadata)Constructs aPropertyof a given that belongs to the given owner, has a given value type, a corresponding setter and getter and optionalPropertyMetadata.Property(Class<T> owner, String name, Class<P> type, com.vaadin.flow.function.SerializableBiConsumer<T,P> setter, com.vaadin.flow.function.SerializableFunction<T,P> getter, PropertyMetadata... metadata)Constructs aPropertyof a given that belongs to the given owner, has a given value type, a corresponding setter and getter and optionalPropertyMetadata.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)Optional<com.vaadin.flow.function.SerializableFunction<T,P>>getGetter()Returns the getter for the property, if any.Map<String,PropertyMetadata>getMetadata()Returns the map ofPropertyMetadata, organised by metadata name for easier use.StringgetName()Returns the name of this property.Class<T>getOwner()Returns the type the property belongs to.Optional<com.vaadin.flow.function.SerializableBiConsumer<T,P>>getSetter()Returns the setter for the property, if any.Class<P>getType()Returns the value type of the property.inthashCode()StringtoString()
-
-
-
Constructor Detail
-
Property
public Property(Class<T> owner, String name, Class<P> type, com.vaadin.flow.function.SerializableBiConsumer<T,P> setter, com.vaadin.flow.function.SerializableFunction<T,P> getter, PropertyMetadata... metadata)
Constructs aPropertyof a given that belongs to the given owner, has a given value type, a corresponding setter and getter and optionalPropertyMetadata.- Parameters:
owner- Object the property belongs to.name- Name of the property.type- Type of the property.setter- Setter. May benull.getter- Getter. May benull.metadata- AnyPropertyMetadatathisPropertyshould have.
-
Property
public Property(Class<T> owner, String name, Class<P> type, com.vaadin.flow.function.SerializableBiConsumer<T,P> setter, com.vaadin.flow.function.SerializableFunction<T,P> getter, Collection<PropertyMetadata> metadata)
Constructs aPropertyof a given that belongs to the given owner, has a given value type, a corresponding setter and getter and optionalPropertyMetadata.- Parameters:
owner- Object the property belongs to.name- Name of the property.type- Type of the property.setter- Setter. May benull.getter- Getter. May benull.metadata- AnyPropertyMetadatathisPropertyshould have.
-
-
Method Detail
-
getName
public String getName()
Returns the name of this property.- Returns:
- Name of the property.
-
getSetter
public Optional<com.vaadin.flow.function.SerializableBiConsumer<T,P>> getSetter()
Returns the setter for the property, if any.- Returns:
- The setter, if any.
-
getGetter
public Optional<com.vaadin.flow.function.SerializableFunction<T,P>> getGetter()
Returns the getter for the property, if any.- Returns:
- The getter, if any.
-
getMetadata
public Map<String,PropertyMetadata> getMetadata()
Returns the map ofPropertyMetadata, organised by metadata name for easier use.- Returns:
- A non-
null, but possibly empty, map ofPropertyMetadataby name. Any changes to the returned map will affect this object.
-
-