Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //****************** Using double brace initialization ********************
- new BaseRoot() {{
- setChild(new BaseChild() {{
- setName("someChildName");
- getContents().add(new ChildContents() {{
- setName(c.getName());
- setId(c.getId());
- }});
- setCharacteristics(new ChildCharacteristics() {{
- setDescriptor(new ChildDescriptor() {{
- setCommonName("someDescriptor");
- }});
- setId(database.getCharId());
- setValue(database.getCharValue());
- }});
- }});
- setName("someName");
- setId(database.getRootId());
- }}
- //******************* Using classic initialization ************************
- BaseRoot root = new BaseRoot();
- BaseChild child = new BaseChild();
- child.setName("someChildName");
- ChildContents content = new ChildContents();
- content.setName(c.getName());
- content.setId(c.getId());
- child.getContents().add(content);
- ChildCharacteristics chars = new ChildCharacteristics();
- ChildDescriptor desc = new ChildDescriptor();
- desc.setCommonName("someDescriptor");
- chars.setDescriptor(desc);
- chars.setId(database.getCharId());
- chars.setValue(database.getCharValue());
- child.setCharacteristics(chars);
- root.setChild(child);
- root.setName("someName");
- root.setId(database.getRootId());
- //******************* Using weird brace initialization ************************
- BaseRoot root = new BaseRoot();
- {
- BaseChild child = new BaseChild();
- {
- child.setName("someChildName");
- ChildContents content = new ChildContents();
- {
- content.setName(c.getName());
- content.setId(c.getId());
- }
- child.getContents().add(content);
- ChildCharacteristics chars = new ChildCharacteristics();
- {
- ChildDescriptor desc = new ChildDescriptor();
- {
- desc.setCommonName("someDescriptor");
- }
- chars.setDescriptor(desc);
- chars.setId(database.getCharId());
- chars.setValue(database.getCharValue());
- }
- child.setCharacteristics(chars);
- }
- root.setChild(child);
- root.setName("someName");
- root.setId(database.getRootId());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement