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
Describes the mapping of a property.
Properties can be either is/set-pairs or get/set-pairs of methods or some other readonly method.
Properties can be either is/set-pairs or get/set-pairs of methods or some other readonly method.
Equality refers to the property name only.
-
Constructor Summary
ConstructorsConstructorDescriptionPropertyMapping(String name, Method getter, Method setter) Creates a property mapping. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the property value.Gets the getter.getName()Gets the name of the property.Gets the setter.Class<?> Gets the type of the value held by the property.
This is the parameter type of the setter, if any, else the return type of the getter.inthashCode()booleanReturns whether the property is readonly.voidSets the property value.
The value will be converted to the type of the property, if necessary.toString()
-
Constructor Details
-
PropertyMapping
Creates a property mapping.- Parameters:
name- the name of the propertygetter- the gettersetter- the setter, null if readonly- Throws:
NullPointerException- if name or getter is null
-
-
Method Details
-
getName
-
getGetter
-
getSetter
-
isReadOnly
public boolean isReadOnly()Returns whether the property is readonly.- Returns:
- true if readonly
-
getValueType
Gets the type of the value held by the property.
This is the parameter type of the setter, if any, else the return type of the getter.- Returns:
- the value type
-
get
Gets the property value.- Parameters:
object- the object containing the property- Returns:
- the value
- Throws:
TentackleRuntimeException- if invoking the getter failed
-
set
Sets the property value.
The value will be converted to the type of the property, if necessary.- Parameters:
object- the object containing the propertyvalue- the value- Throws:
ImmutableException- if the property is readonlyIllegalArgumentException- if the value cannot be converted to the type of the propertyTentackleRuntimeException- if invoking the setter failed- See Also:
-
equals
-
hashCode
-
toString
-