Class PropertyMapping<T>

java.lang.Object
org.tentackle.reflect.PropertyMapping<T>
Type Parameters:
T - the type of the bean providing the property
Direct Known Subclasses:
FxPropertyMapping

public class PropertyMapping<T> extends Object
Describes the mapping of a property.
Properties can be either is/set-pairs or get/set-pairs of methods or some other readonly method.
  • Constructor Details

    • PropertyMapping

      public PropertyMapping(String name, Method getter, Method setter)
      Creates a property mapping.
      Parameters:
      name - the name of the property
      getter - the getter
      setter - the setter, null if readonly
  • Method Details

    • getName

      public String getName()
      Gets the name of the property.
      Returns:
      the name
    • getGetter

      public Method getGetter()
      Gets the getter.
      Returns:
      the getter
    • getSetter

      public Method getSetter()
      Gets the setter.
      Returns:
      the setter, null if read-only
    • isReadOnly

      public boolean isReadOnly()
      Returns whether the property is readonly.
      Returns:
      true if readonly
    • getValueType

      public Class<?> getValueType()
      Gets the type of the value held by the property.
      Returns:
      the value type
    • get

      public Object get(T object)
      Gets the property value.
      Parameters:
      object - the object containing the property
      Returns:
      the value
    • set

      public void set(T object, Object value)
      Sets the property value.
      The value will be converted to the type of the property, if necessary.

      Throws a ImmutableException if property is readonly.
      Throws a IllegalArgumentException if value cannot be converted to the type of the property.

      Parameters:
      object - the object containing the property
      value - the value
    • 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