Package com.quartetfs.fwk
Interface IProperty
-
- All Known Subinterfaces:
ICompilableProperty,ICompiledProperty<T>,ICustomProperty,IRecordProperty
- All Known Implementing Classes:
ACustomProperty,ADatabaseVersionAwareProperty,AProperty,ArrayLastElementProperty,ArrayProperty,BaseProperty,CompiledAndChainProperty,CompiledProperty,ConstantValueProperty,CustomProperty,DynamicProperty,ListLastElementProperty,ListProperty,MapProperty,Property
public interface IProperty extends IClone<IProperty>
The IProperty interface generalizes the concept of properties that you can read or write to an object.A property works like the getter/setter pair on a javabean, but for any kind of object, and for any kind of accessor depending on the implementation of the IProperty interface.
There is no class passed in the API. This means that the implementation has to discover it.
It is left to the implementor to cache or not the discovered methods.
A property is qualified by the following attributes:
- name: the name identifying the property
- expression (optional): an expression that specifies how the property can access values from
target objects. Examples include:
- Simple object attribute: "Country" [similar to target.getCountry();]
- Object path: "Customer/Address/Street" [similar to target.getCustomer().getAddress().getStreet();]
- Collection index: "Children[2]" [similar to target.getChildren.get(2);]
- XML XPath
- ...
A property value should also derive the AProperty abstract class, so that XML serialization frameworks automatically register the custom class.
- Author:
- ActiveViam
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetExpression()Gets the expression defining this property.StringgetName()Gets the name of this property.List<IProperty>getPropertyChain()Get the property chain corresponding to this property, that is the chain of atomic properties defining this property.ObjectgetValue(Object target)Gets the value of this property from a target object.voidsetValue(Object target, Object value)Sets the value of this property on a target object.
-
-
-
Method Detail
-
getName
String getName()
Gets the name of this property.- Returns:
- the name
-
getExpression
String getExpression()
Gets the expression defining this property.- Returns:
- the expression formula
-
getValue
Object getValue(Object target) throws ActiveViamRuntimeException
Gets the value of this property from a target object.- Parameters:
target- target object- Returns:
- property value
- Throws:
ActiveViamRuntimeException- when the property cannot be read
-
setValue
void setValue(Object target, Object value) throws ActiveViamRuntimeException
Sets the value of this property on a target object.- Parameters:
target- target objectvalue- value to set- Throws:
ActiveViamRuntimeException- when the property cannot be set
-
getPropertyChain
List<IProperty> getPropertyChain()
Get the property chain corresponding to this property, that is the chain of atomic properties defining this property.E.g. the property with expression 'currency/code' has a property chain of length 2, the first element being a property with expression 'currency' and the second a property with expression 'code'.
- Returns:
- The property chain.
-
-