Skip to content

Conversation

@ashleyheath
Copy link

First pass at add and put methods for building collections and maps within beans (see #100).

  • Creates addPropertyName(value) methods for collections and one-dimensional arrays within beans. Higher-dimensional arrays are currently ignored.
  • Creates putPropertyName(key, value) methods for maps within beans.
  • The add and put methods use immutable builders to create new instances of the appropriate collection with the new element appended. This is presumably less efficient than initialising the bean builder with instances of the collection builders and simply adding to them - however that looks like it would require a significant re-write of the builder generation code.
  • Does not currently attempt to translate the property name into its singular value but this wouldn't be difficult to add (and for my money is nicer). Probably should also have a new property on the @PropertyDefinition annotation (singular?) to allow overriding when the 'smart' generation picks something nonsensical or that clashes with other code.
  • All maps and collections are currently constructed using guava's immutable builders. Not sure what the expected collection implementations are for mutable beans?
  • The NavigableSet, NaviableMap, Grid, and ImmutableGrid types are not currently supported (due to not having a equivalent builders.
  • For put(key, value) methods, the javadoc for key states that it shoud be non-null but the javadoc for the value does not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant