-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Options/Attributes builders/build instances are no more "readable" #1080
Comments
Hard to recall all the conversation but we wanted to have typed cleaner methods that was more Java like and less like a simple Ruby wrapper. // Application layer
Map<String, String> attributesTemplate = new HashMap<>();
attributesTemplate.put("attribute-1", "value-1");
attributesTemplate.put("attribute-2", "value-2");
Map<String, String> optionsTemplate = new HashMap<>();
attributesTemplate.put("option-1", "value-1");
attributesTemplate.put("option-2", "value-2");
// Converter Helper
final AttributesBuilder attributesBuilder = Attributes.builder();
attributesTemplate.forEach((k, v) -> attributesBuilder.attribute(k, v));
final OptionsBuilder optionsBuilder = Options.builder();
optionsTemplate.forEach((k, v) -> optionsBuilder.option(k, v));
final Options optionsToPass = optionsBuilder.attributes(attributesBuilder.build())
.build(); |
I can see that but it is quite inconvenient and technically it is still a map so instance -> builder should be easily doable, no? Most important is an easy api after all IMHO. |
Working on removing the |
Only read part, factory is easy to workaround. |
Having access to the map (or contained attributes) is also very useful for unit testing of code that produces Attributes and Options. |
Hi,
The main issue in recent version is the map access is deprecated but it is actually very useful to have a "template" instance (options/attributes) and copy+modify it for renders at needs.
Would be neat to get back something at least readable - best being to create an option builder from an options (resp attribute) instance as a copy.
The text was updated successfully, but these errors were encountered: