Package com.composum.nodes.debugutil
Class YamlObjectDumper
- java.lang.Object
-
- java.util.AbstractMap<Object,String>
-
- com.composum.nodes.debugutil.YamlObjectDumper
-
public class YamlObjectDumper extends AbstractMap<Object,String>
This gets an Object as argument and recursively dumps all properties into a JSON. Not threadsafe.Use in a JSP e.g.:
DUMP: <%= new com.composum.nodes.debugutil.YamlObjectDumper().get(pageContext.getAttribute("variable")) %>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description protected String
indentStep
protected Pattern
onlyNewlineAndSpace
boolean
printLineNumbers
protected StringBuilder
sb
protected IdentityHashMap<Object,Object>
seen
To avoid recursion we keep what's already written.
-
Constructor Summary
Constructors Constructor Description YamlObjectDumper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addMethods(Class<?> aClass, List<Method> methods)
String
dump(Object o, int maxdepth)
protected void
dump(Object o, int maxdepth, String indent)
Set<Map.Entry<Object,String>>
entrySet()
String
get(Object key)
For access with Sightly / HTL: create variable with this and (ab-)use it as a map.static boolean
isMethodOverriddenFromObject(Method method)
int
lineNumber()
-
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Field Detail
-
sb
protected StringBuilder sb
-
indentStep
protected final String indentStep
- See Also:
- Constant Field Values
-
seen
protected IdentityHashMap<Object,Object> seen
To avoid recursion we keep what's already written.
-
printLineNumbers
public boolean printLineNumbers
-
onlyNewlineAndSpace
protected final Pattern onlyNewlineAndSpace
-
-
Method Detail
-
get
public String get(Object key)
For access with Sightly / HTL: create variable with this and (ab-)use it as a map.
-
isMethodOverriddenFromObject
public static boolean isMethodOverriddenFromObject(Method method)
-
lineNumber
public int lineNumber()
-
-