org.jboss.dna.repository.sequencer
Class SequencerOutputMap

java.lang.Object
  extended by org.jboss.dna.repository.sequencer.SequencerOutputMap
All Implemented Interfaces:
Iterable<SequencerOutputMap.Entry>, SequencerOutput

@NotThreadSafe
public class SequencerOutputMap
extends Object
implements SequencerOutput, Iterable<SequencerOutputMap.Entry>

A basic SequencerOutput that records all information in-memory and which organizes the properties by node paths and provides access to the nodes in a natural path-order.

Author:
Randall Hauch, John Verhaeg

Nested Class Summary
 class SequencerOutputMap.Entry
          An entry in a SequencerOutputMap, which contains the path of the node and the property values on the node.
 class SequencerOutputMap.PropertyValue
          A property name and value pair.
 
Constructor Summary
SequencerOutputMap(ValueFactories factories)
           
 
Method Summary
 boolean isEmpty()
          Return whether there are no entries
 Iterator<SequencerOutputMap.Entry> iterator()
          Return the entries in this output in an order with shorter paths first.
 void setProperty(Path nodePath, Name propertyName, Object... values)
          Set the supplied property on the supplied node.
 void setProperty(String nodePath, String property, Object... values)
          Set the supplied property on the supplied node.
 void setReference(String nodePath, String propertyName, String... paths)
          Set the supplied reference on the supplied node.
 int size()
          Return the number of node entries in this map.
 String toString()
          
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SequencerOutputMap

public SequencerOutputMap(ValueFactories factories)
Method Detail

setProperty

public void setProperty(Path nodePath,
                        Name propertyName,
                        Object... values)
Set the supplied property on the supplied node.

The value factories should be used to create paths, names, and values. These factories can be used to create new values or convert values from one property type to another. (Note that each of the factories have methods that create values from all of the property types.)

Specified by:
setProperty in interface SequencerOutput
Parameters:
nodePath - the path to the node containing the property; may not be null
propertyName - the name of the property to be set
values - the value(s) for the property; may be empty if any existing property is to be removed

setProperty

public void setProperty(String nodePath,
                        String property,
                        Object... values)
Set the supplied property on the supplied node.

The value factories should be used to create paths, names, and values. These factories can be used to create new values or convert values from one property type to another. (Note that each of the factories have methods that create values from all of the property types.)

This method is provided as a convenience, but it identical to creating a Path and Name using the factories and calling SequencerOutput.setProperty(Path, Name, Object...).

Specified by:
setProperty in interface SequencerOutput
Parameters:
nodePath - the path to the node containing the property; may not be null
property - the name of the property to be set
values - the value(s) for the property; may be empty if any existing property is to be removed

setReference

public void setReference(String nodePath,
                         String propertyName,
                         String... paths)
Set the supplied reference on the supplied node.

This method is provided as a convenience, but it identical to creating a Path and Name using the factories and calling SequencerOutput.setProperty(Path, Name, Object...).

Specified by:
setReference in interface SequencerOutput
Parameters:
nodePath - the path to the node containing the property; may not be null
propertyName - the name of the property to be set
paths - the paths to the referenced property, which may be absolute paths or relative to the sequencer output node; may be empty if any existing property is to be removed

size

public int size()
Return the number of node entries in this map.

Returns:
the number of entries

isEmpty

public boolean isEmpty()
Return whether there are no entries

Returns:
true if this container is empty, or false otherwise

iterator

public Iterator<SequencerOutputMap.Entry> iterator()
Return the entries in this output in an order with shorter paths first.

Specified by:
iterator in interface Iterable<SequencerOutputMap.Entry>

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2008-Present JBoss a division of Red Hat. All Rights Reserved.