- java.lang.Object
-
- org.refcodes.runtime.DumpBuilder
-
- All Implemented Interfaces:
org.refcodes.mixin.ObjectAccessor,org.refcodes.mixin.ObjectAccessor.ObjectBuilder<DumpBuilder>,org.refcodes.mixin.ObjectAccessor.ObjectMutator,org.refcodes.mixin.ObjectAccessor.ObjectProperty
public class DumpBuilder extends Object implements org.refcodes.mixin.ObjectAccessor.ObjectProperty, org.refcodes.mixin.ObjectAccessor.ObjectBuilder<DumpBuilder>
TheDumpBuilderassists you in inspecting the content of an object. Creates aMapcontaining the dump of an object's the member variable's values, the names being the keys and the values being the member variables' values.
-
-
Constructor Summary
Constructors Constructor Description DumpBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Map<String,String>asDump(Object aObj)Dumps the the provided object into aMapwhich is returned as result (the builder needs not to be instantiated).ObjectgetObject()voidsetObject(Object aObject)Map<String,String>toDump()Dumps the state of the contained object (as ofsetObject(Object)) into aMapwhich is returned as result.Map<String,String>toDump(Object aObj)Dumps the state of the provided object into aMapwhich is returned as result.protected static Map<String,String>toDump(Object aObj, Map<String,String> aDump)Dumps the state of the implementing instance into the providedMapwhich is returned as result.DumpBuilderwithObject(Object aObject)
-
-
-
Method Detail
-
getObject
public Object getObject()
- Specified by:
getObjectin interfaceorg.refcodes.mixin.ObjectAccessor
-
setObject
public void setObject(Object aObject)
- Specified by:
setObjectin interfaceorg.refcodes.mixin.ObjectAccessor.ObjectMutator
-
withObject
public DumpBuilder withObject(Object aObject)
- Specified by:
withObjectin interfaceorg.refcodes.mixin.ObjectAccessor.ObjectBuilder<DumpBuilder>
-
toDump
public Map<String,String> toDump(Object aObj)
Dumps the state of the provided object into aMapwhich is returned as result.- Parameters:
aObj- The object for which to create the dump.- Returns:
- The
Mapwith the dumped properties of the implementing instance.
-
toDump
public Map<String,String> toDump()
Dumps the state of the contained object (as ofsetObject(Object)) into aMapwhich is returned as result.- Returns:
- The
Mapwith the dumped properties of the implementing instance.
-
asDump
public static Map<String,String> asDump(Object aObj)
Dumps the the provided object into aMapwhich is returned as result (the builder needs not to be instantiated).- Parameters:
aObj- The object for which to create the dump.- Returns:
- The
Mapwith the dumped properties of the implementing instance.
-
toDump
protected static Map<String,String> toDump(Object aObj, Map<String,String> aDump)
Dumps the state of the implementing instance into the providedMapwhich is returned as result. This default implementation uses reflection to create a basic dump.Mapproperties are processed but not recursively digged into. Existing properties are overwritten in case shadowing super-class's properties.
-
-