This PR adds support for nested members. Getting the syntax right for this is a bit tricky as you want to be able to reference both the top-level field as well as all nested members without name clashing. Some of the things I tried
1) Use underscore for everything
PersonFields.FAVORITE_DOG_NAME;
2) Use special named inner class.
PersonFields.FAVORITE_DOG
PersonFields.FavoriteDogFields.NAME
3) End fieldname with $ if it is a link.
PersonFields.FAVORITE_DOG$
PersonFields.FAVORITE_DOG.NAME
4) With 4 there is a slight chance of name clashing if people already use $ for something.
It is a bit clearer if the $ is after the separator.
PersonFields.FAVORITE_DOG.$; // for the "favoriteDog" field in Person.
PersonFields.FAVORITE_DOG.NAME; // All linked fields
In the end I ended on using $ as a "type terminator". This made it possible to use dot syntax to find a nested name. From my experience it is more common to actually reference a nested field than the field name itself, so this seems acceptable.
Feedback is welcome. I made the branch available as 1.1.0-SNAPSHOT so it is easy to test.
Closes #4
This PR adds support for nested members. Getting the syntax right for this is a bit tricky as you want to be able to reference both the top-level field as well as all nested members without name clashing. Some of the things I tried
In the end I ended on using
$
as a "type terminator". This made it possible to use dot syntax to find a nested name. From my experience it is more common to actually reference a nested field than the field name itself, so this seems acceptable.Feedback is welcome. I made the branch available as
1.1.0-SNAPSHOT
so it is easy to test.