...
Note: You can also have a tree-like structure using ComplexValueDTO objects, that means, you can have a list of ComplexValueDTO objects inside another ComplexValueDTO object. The example would look like this:
Code Block | ||
---|---|---|
| ||
private static final String ROOT_KEY = "ROOT";
private static final String CHILD_ONE_KEY = "CHILD_ONE";
private static final String SUB_CHILD_ONE_KEY = "SUB_CHILD_ONE";
private static final String SUB_CHILD_TWO_KEY = "SUB_CHILD_TWO";
private static final String DUMMY_KEY = "DUMMY";
private static final String DUMMY_VALUE = "DUMMY"
<...>
public void doSomething() {
<...>
StringValueDTO dummy = new StringValueDTO();
dummy.setKey(DUMMY_KEY);
dummy.setValue(DUMMY_VALUE);
ComplexValueDTO subChildOne = new ComplexValueDTO();
subChildOne.setKey(SUB_CHILD_ONE_KEY);
subChildOne.getValue().add(dummy);
ComplexValueDTO subChildTwo = new ComplexValueDTO();
subChildTwo.setKey(SUB_CHILD_TWO_KEY);
subChildTwo.getValue().add(dummy);
ComplexValueDTO childOne = new ComplexValueDTO();
childOne.setKey(CHILD_ONE_KEY);
childOne.getValue().add(subChildOne);
childOne.getValue().add(subChildTwo);
ComplexValueDTO root = new ComplexValueDTO();
context.setKey(ROOT_KEY);
context.getValue().add(childOne);
<...>
}
<...> |
This becomes useful when you need to transfer some kind of very complex object and pass it to the workflow framework.