Skip to content
Arnaud Roger edited this page Jan 27, 2015 · 18 revisions

The rules

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.

property name matching

is a case insensitive match ignoring '_' and ' '.

the following column will matches the property myProperty.

  • 'my_property'
  • 'myproperty'
  • 'my property'

inner object matching

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'

list/array

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

Tuples work in the same way as list/array but the size is limited and the types can be different depending on the element.

index discovery

If no index is found it will try to find a empty index where the element has not been injected the property yet.

Injection

The property mapping will look for a injection vector in the following order

  1. Constructor Injection
  2. Setter Injection
  3. 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.

Property Finder

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");
Clone this wiki locally