Package org.reldb.dbLogger
Class Flattener
java.lang.Object
org.reldb.dbLogger.Flattener
public class Flattener
extends java.lang.Object
Copy a hierarchy of Map, List, and scalar value containment -- e.g., an instance/container-instance
hierarchy of nested containers, such as a JSON object, HTML DOM, etc. -- to a flat Map.
-
Constructor Summary
Constructors Constructor Description Flattener()
-
Method Summary
Modifier and Type Method Description static void
flatten(java.lang.String attributeName, java.lang.Object value, java.util.Map<java.lang.String,java.lang.Object> target)
Flatten a datum named attributeName which may be a List, Map, or some scalar value to the target Map.static void
flatten(java.lang.String containerName, java.util.Map<?,?> source, java.util.Map<java.lang.String,java.lang.Object> target)
Flatten a Map named containerName -- which may contain ListS, MapS, or scalar values -- to the target Map.static java.util.Map<java.lang.String,java.lang.Object>
flatten(java.util.Map<?,?> source)
Flatten a Map -- which may contain ListS, MapS, or scalar values -- to a target Map.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Flattener
public Flattener()
-
-
Method Details
-
flatten
public static void flatten(java.lang.String attributeName, java.lang.Object value, java.util.Map<java.lang.String,java.lang.Object> target)Flatten a datum named attributeName which may be a List, Map, or some scalar value to the target Map.- Parameters:
attributeName
- The name of this attribute as its known in its parent container. Used to construct new attribute names.value
- The List, Map to be flattened and stored, or the value to be stored, in the target.target
- The Map to receive the flattened data.
-
flatten
public static void flatten(java.lang.String containerName, java.util.Map<?,?> source, java.util.Map<java.lang.String,java.lang.Object> target)Flatten a Map named containerName -- which may contain ListS, MapS, or scalar values -- to the target Map.- Parameters:
containerName
- The name of the source Map as an attribute in its parent Map. Used to construct new attribute names.source
- The Map to be flattenedtarget
- The Map to receive the flattened attributes
-
flatten
public static java.util.Map<java.lang.String,java.lang.Object> flatten(java.util.Map<?,?> source)Flatten a Map -- which may contain ListS, MapS, or scalar values -- to a target Map.- Parameters:
source
- The Map to be flattened- Returns:
- The flattened Map.
-