public class PropertyScrambler extends java.lang.Object implements ObjectTransform
An example. Suppose you had an input object with a property name "hue", that you want to pass to something that requires a property named "color". If you created a PropertyScrambler with the propertyMapping set to {"color" = "hue"} you'd be all set.
Another example. Suppose you (in a report or something) need two copies of an object. Then you could use a propertyMapping {"copy1" = ".", "copy2" = "."} and be ready to go.
Additionally, if you provide a list of property paths instead of a single path, it will choose the value of the first property in the list that is nontrivial - i.e., neither null nor blank.
| Constructor and Description |
|---|
PropertyScrambler() |
PropertyScrambler(java.util.Map propertyMapping) |
| Modifier and Type | Method and Description |
|---|---|
java.util.Map |
getPropertyMapping() |
boolean |
isPassingThrough()
If true, also passes through unlisted properties unchanged (unless their
names have been overridden by the mapping).
|
void |
setPassingThrough(boolean tizit) |
void |
setPropertyMapping(java.util.Map newMapping) |
java.lang.Object |
transform(java.lang.Object victim)
Our one method; this transforms one object into another.
|
public PropertyScrambler()
public PropertyScrambler(java.util.Map propertyMapping)
public java.lang.Object transform(java.lang.Object victim)
ObjectTransformtransform in interface ObjectTransformpublic java.util.Map getPropertyMapping()
public void setPropertyMapping(java.util.Map newMapping)
public boolean isPassingThrough()
public void setPassingThrough(boolean tizit)