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 Details

    • 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 a Property of a given that belongs to the given owner, has a given value type, a corresponding setter and getter and optional PropertyMetadata.
      Parameters:
      owner - Object the property belongs to.
      name - Name of the property.
      type - Type of the property.
      setter - Setter. May be null.
      getter - Getter. May be null.
      metadata - Any PropertyMetadata this Property should 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 a Property of a given that belongs to the given owner, has a given value type, a corresponding setter and getter and optional PropertyMetadata.
      Parameters:
      owner - Object the property belongs to.
      name - Name of the property.
      type - Type of the property.
      setter - Setter. May be null.
      getter - Getter. May be null.
      metadata - Any PropertyMetadata this Property should have.
  • Method Details

    • getName

      public String getName()
      Returns the name of this property.
      Returns:
      Name of the property.
    • getOwner

      public Class<T> getOwner()
      Returns the type the property belongs to.
      Returns:
      Type.
    • 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.
    • getType

      public Class<P> getType()
      Returns the value type of the property.
      Returns:
      Value type.
    • getMetadata

      public Map<String,PropertyMetadata> getMetadata()
      Returns the map of PropertyMetadata, organised by metadata name for easier use.
      Returns:
      A non-null, but possibly empty, map of PropertyMetadata by name. Any changes to the returned map will affect this object.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object