|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jcon.data.PropertyScrambler
public class PropertyScrambler
Lets you rename and duplicate BeanGraph properties. An ObjectTransform that, configured with a mapping of old property names onto new ones, transforms BeanGraphable objects into Maps with the new property names.
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 Summary | |
|---|---|
PropertyScrambler()
|
|
PropertyScrambler(java.util.Map propertyMapping)
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PropertyScrambler()
public PropertyScrambler(java.util.Map propertyMapping)
| Method Detail |
|---|
public java.lang.Object transform(java.lang.Object victim)
ObjectTransform
transform in interface ObjectTransformpublic java.util.Map getPropertyMapping()
public void setPropertyMapping(java.util.Map newMapping)
public boolean isPassingThrough()
public void setPassingThrough(boolean tizit)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||