-
Notifications
You must be signed in to change notification settings - Fork 75
Property Mapping
The property finder will look for a column to property match first, if none is found it will try to do a partial match on the property to look for a sub property.
is a case insensitive match ignoring '_' and ' '.
the following column will matches the property myProperty.
- 'my_property'
- 'myproperty'
- 'my property'
the inner object matching is done if the complete matching did not found any property. The finder will try to match the start of the column to a property of the object and then will do a match against the column name left over.
for a property property.subProperty the following will match
- 'property_sub_property'
- 'propertysubproperty'
- 'property sub property'
if the type of the object is a array or a list then the finder will look for the first number in the column and use at as the index to put the element in. if there is a subproperty specify after the number that will be match against the element class. If not it will look for a 1 argument constructor.
- List myList, 'my_list_3' -> will match against the 3rd element of the list as a String.
- List myList, 'my_list_3_id' -> will match against property id of the 3rd element of the list.
Tuples work in the same way as list/array but the size is limited and the types can be different depending on the element.
If no index is found it will try to find a empty index where the element has not been injected the property yet.
The property mapping will look for a injection vector in the following order
- Constructor Injection
- Setter Injection
- Field Injection
final field semantic is respected. The constructor injection will need the asm library to extract the name of the parameters except for one parameter constructors.
The property matching is done by the PropertyFinder.
ClassMeta<MyObject> classMeta = new ReflectionService().getClassMeta(MyObject.class);
PropertyFinder<MyObject> propertyFinder = classMeta.newPropertyFinder();
PropertyMeta<MyObject, ?> prop = propertyFinder.findProperty("my_property");