Interface IProperty
- All Known Subinterfaces:
ICompilableProperty
,ICompiledProperty<T>
,ICustomProperty
- All Known Implementing Classes:
ACustomProperty
,ADatabaseVersionAwareProperty
,AliasProperty
,AProperty
,ArrayLastElementProperty
,ArrayProperty
,BaseProperty
,CompiledAndChainProperty
,CompiledProperty
,ConstantValueProperty
,CustomProperty
,DynamicProperty
,ListLastElementProperty
,ListProperty
,MapProperty
,Property
public interface 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
Modifier and TypeMethodDescriptioncopy()
Returns a copy of this property.Gets the expression defining this property.getName()
Gets the name of this property.Get the property chain corresponding to this property, that is the chain of atomic properties defining this property.Gets the value of this property from a target object.void
Sets the value of this property on a target object.
-
Method Details
-
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
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
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
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.
-
copy
IProperty copy()Returns a copy of this property.
-