org.cubeengine.converter.node
Class MapNode

java.lang.Object
  extended by org.cubeengine.converter.node.Commentable
      extended by org.cubeengine.converter.node.Node<V>
          extended by org.cubeengine.converter.node.ContainerNode<Map<String,Node>>
              extended by org.cubeengine.converter.node.MapNode

public class MapNode
extends ContainerNode<Map<String,Node>>

A MapNode

It can map KeyNodes onto other Nodes


Constructor Summary
MapNode()
           
 
Method Summary
 String asString()
           
 void cleanUpEmptyNodes()
          Searches for ParentNodes that do not contain data and deletes them
static MapNode emptyMap()
          Creates an empty MapNode
 Node get(String key)
          Returns the Node for given direct key (without pathseparators).
 String getFirstKey()
          Returns the first key of this MapNode or null if the map is empty
 Map<String,Node> getMappedNodes()
           
 String getOriginalKey(String lowerCasedKey)
           
 Map<String,Node> getValue()
          Gets the Value contained in this Node
 void inheritFrom(Node node)
           
 boolean isEmpty()
          Returns whether this Node contains data
protected  Node remove(String key)
          Removes the Node for given direct key (without pathseparators).
 Node set(String key, Node node)
          Sets this Node for given key The key will be lowercased!
 
Methods inherited from class org.cubeengine.converter.node.ContainerNode
asText, get, remove, set
 
Methods inherited from class org.cubeengine.converter.node.Node
isInherited, setInherited
 
Methods inherited from class org.cubeengine.converter.node.Commentable
getComments, setComments
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapNode

public MapNode()
Method Detail

getValue

public Map<String,Node> getValue()
Description copied from class: Node
Gets the Value contained in this Node

Specified by:
getValue in class Node<Map<String,Node>>
Returns:
the NodeValue

emptyMap

public static MapNode emptyMap()
Creates an empty MapNode

Returns:
an empty MapNode

get

public Node get(String key)
Description copied from class: ContainerNode
Returns the Node for given direct key (without pathseparators).

The key will be lowercased!

Specified by:
get in class ContainerNode<Map<String,Node>>
Parameters:
key - the key
Returns:
the matched Node or null

set

public final Node set(String key,
                      Node node)
Description copied from class: ContainerNode
Sets this Node for given key

The key will be lowercased!

Specified by:
set in class ContainerNode<Map<String,Node>>
Parameters:
key - the key
node - the Node to set
Returns:
the previously mapped Node or null if not set

remove

protected final Node remove(String key)
Description copied from class: ContainerNode
Removes the Node for given direct key (without pathseparators).

The key will be lowercased!

Specified by:
remove in class ContainerNode<Map<String,Node>>
Parameters:
key - the key
Returns:
the previously mapped Node or null if not set

getOriginalKey

public String getOriginalKey(String lowerCasedKey)

getMappedNodes

public Map<String,Node> getMappedNodes()

isEmpty

public boolean isEmpty()
Description copied from class: ContainerNode
Returns whether this Node contains data

Specified by:
isEmpty in class ContainerNode<Map<String,Node>>
Returns:
true if this Node contains no data

cleanUpEmptyNodes

public void cleanUpEmptyNodes()
Description copied from class: ContainerNode
Searches for ParentNodes that do not contain data and deletes them

Specified by:
cleanUpEmptyNodes in class ContainerNode<Map<String,Node>>

asString

public String asString()
Specified by:
asString in class Node<Map<String,Node>>

getFirstKey

public String getFirstKey()
Returns the first key of this MapNode or null if the map is empty

Returns:
the first key or null

inheritFrom

public void inheritFrom(Node node)


Copyright © 2013–2017. All rights reserved.