Closed chriszwickerocteris closed 4 years ago
May I suggest also updating the docs?
I would suggest the following:
List<String>
myList, "my_list_3"
-> will match against the 4th element (the element at array index 3) of the list as a String.
List<MyObject>
myList, "my_list_3_id"
-> will match against property id of the 4th element (the element at array index 3) of the list.
Index behaviour can be switched from zero-indexed to one-indexed by adding column property ArrayIndexStartAtProperty.ONE
to the configuration, e.g.
import org.simpleflatmapper.reflect.property.ArrayIndexStartAtProperty;
// ...
mapperFactory.addColumnProperty("my_column", ArrayIndexStartAtProperty.ONE);
// ...
Definitely
The documentation seems to state that columns with a name that ends in
_[0-9]+
will map to the nth element in an array / list.One issue is with the documentation: what seems to happen is that SFM actually maps to element n+1 (
a_1
maps to the second element, the element at index 1).The bigger problem is that whenever a path segment ends in a number, it seems to be interpreted as just a number;
a_b1
seems to equally be interpreted as the second element in a lista
- ignoring thatb1
might be the name of an element the type that is contained in said list.Here's a reproducing test: