org.specrunner.util.xom
Interface INodeHolder

All Known Implementing Classes:
CellAdapter, NodeHolder, RowAdapter, TableAdapter

public interface INodeHolder

Stands for any object which hold an element.

Author:
Thiago Santos

Field Summary
static String ATTRIBUTE_ARGUMENT_PREFIX
          Attribute for arguments prefix.
static String ATTRIBUTE_COMPARATOR
          Attribute for comparator.
static String ATTRIBUTE_CONVERTER
          Attribute for converter.
static String ATTRIBUTE_EVALUATION
          Attribute for value evaluation.
static String ATTRIBUTE_PROPERTY
          Attribute for property access.
static String ATTRIBUTE_VALUE
          Attribute for value.
 
Method Summary
 void append(nu.xom.Node node)
          Append node to the node.
 void append(String text)
          Append text to the node.
 boolean attributeContains(String name, String value)
          Check if an attribute exists, and if it exists, if it contains the given value.
 boolean attributeEquals(String name, String value)
          Check if an attribute exists, and if it exists, if it is equal to the given value.
 void detach()
          Detaches the current node.
 List<String> getArguments()
          Get element arguments in a array.
 List<String> getArguments(List<String> arguments)
          Get element arguments in a array.
 String getAttribute(String name)
          Get attribute value by type.
 String getAttribute(String name, String defaultValue)
          Get attribute value by type.
 String getAttributeValue()
          Set attribute value to look for on getObject(...)
 IComparator getComparator()
          Get the comparator of the given element.
 IComparator getComparator(IComparator comparatorDefault)
          Get the comparator of the given element.
 IConverter getConverter()
          Get the converter.
 IConverter getConverter(IConverter converterDefault)
          Get the converter, if any, otherwise returns the default converter.
 nu.xom.Node getNode()
          Get the hold node.
 Object getObject(IContext context, boolean silent)
          Gets the corresponding value object.
 Object getObject(IContext context, boolean silent, IConverter converter, List<String> arguments)
          Gets the corresponding value object.
 String getQualifiedName()
          Get qualified name (include namespace).
 String getValue()
          Get element value.
 boolean hasAttribute(String name)
          Check if an given attribute is present.
 boolean hasName(String name)
          Check a tag name.
 void prepend(nu.xom.Node node)
          Prepend a note to the node.
 void prepend(String text)
          Prepend text to the node.
 void removeAttribute(String name)
          Remove a attribute.
 void setAttribute(String name, String value)
          Set attribute value.
 void setAttributeValue(String attributeValue)
          Set value attribute holder.
 void setNode(nu.xom.Node node)
          Set the hold node.
 void setValue(String text)
          Set text to a node removing all children elements.
 String toXML()
          The XML representation.
 

Field Detail

ATTRIBUTE_PROPERTY

static final String ATTRIBUTE_PROPERTY
Attribute for property access.

See Also:
Constant Field Values

ATTRIBUTE_VALUE

static final String ATTRIBUTE_VALUE
Attribute for value.

See Also:
Constant Field Values

ATTRIBUTE_COMPARATOR

static final String ATTRIBUTE_COMPARATOR
Attribute for comparator.

See Also:
Constant Field Values

ATTRIBUTE_EVALUATION

static final String ATTRIBUTE_EVALUATION
Attribute for value evaluation.

See Also:
Constant Field Values

ATTRIBUTE_CONVERTER

static final String ATTRIBUTE_CONVERTER
Attribute for converter.

See Also:
Constant Field Values

ATTRIBUTE_ARGUMENT_PREFIX

static final String ATTRIBUTE_ARGUMENT_PREFIX
Attribute for arguments prefix.

See Also:
Constant Field Values
Method Detail

getNode

nu.xom.Node getNode()
Get the hold node.

Returns:
The node.

setNode

void setNode(nu.xom.Node node)
Set the hold node.

Parameters:
node - The node.

detach

void detach()
Detaches the current node.


getAttributeValue

String getAttributeValue()
Set attribute value to look for on getObject(...) calls.Default is ATTRIBUTE_VALUE.

Returns:
The attribute value holder.

setAttributeValue

void setAttributeValue(String attributeValue)
Set value attribute holder.

Parameters:
attributeValue - A attribute name.

getQualifiedName

String getQualifiedName()
Get qualified name (include namespace).

Returns:
The local name.

hasName

boolean hasName(String name)
Check a tag name.

Parameters:
name - The name.
Returns:
true, if element name match, false, otherwise.

hasAttribute

boolean hasAttribute(String name)
Check if an given attribute is present.

Parameters:
name - The attribute name.
Returns:
true, if present, false, otherwise.

getAttribute

String getAttribute(String name)
Get attribute value by type.

Parameters:
name - The name.
Returns:
The value, if exists, null, otherwise.

getAttribute

String getAttribute(String name,
                    String defaultValue)
Get attribute value by type.

Parameters:
name - The name.
defaultValue - The defaul value.
Returns:
The value, if exists, null, otherwise.

setAttribute

void setAttribute(String name,
                  String value)
Set attribute value.

Parameters:
name - The name.
value - The value.

removeAttribute

void removeAttribute(String name)
Remove a attribute.

Parameters:
name - The attribute name.

attributeContains

boolean attributeContains(String name,
                          String value)
Check if an attribute exists, and if it exists, if it contains the given value.

Parameters:
name - The attribute name.
value - The attribute value.
Returns:
true, if attribute exists and if contains value, false, otherwise.

attributeEquals

boolean attributeEquals(String name,
                        String value)
Check if an attribute exists, and if it exists, if it is equal to the given value.

Parameters:
name - The attribute name.
value - The attribute value.
Returns:
true, if attribute exists and the value matches, false, otherwise.

getValue

String getValue()
Get element value.

Returns:
Element value.

setValue

void setValue(String text)
Set text to a node removing all children elements.

Parameters:
text - The expected text.

prepend

void prepend(String text)
Prepend text to the node.

Parameters:
text - A text.

prepend

void prepend(nu.xom.Node node)
Prepend a note to the node.

Parameters:
node - A node.

append

void append(String text)
Append text to the node.

Parameters:
text - A text.

append

void append(nu.xom.Node node)
Append node to the node.

Parameters:
node - A node.

getConverter

IConverter getConverter()
                        throws ConverterException
Get the converter.

Returns:
A converter.
Throws:
ConverterException - On converter lookup error.

getConverter

IConverter getConverter(IConverter converterDefault)
                        throws ConverterException
Get the converter, if any, otherwise returns the default converter.

Parameters:
converterDefault - The default converter.
Returns:
A converter.
Throws:
ConverterException - On converter lookup error.

getArguments

List<String> getArguments()
Get element arguments in a array.

Returns:
The list of values set for 'arg0', 'arg1',... 'argN'.

getArguments

List<String> getArguments(List<String> arguments)
Get element arguments in a array.

Parameters:
arguments - The default arguments in case of not found.
Returns:
The list of values set for 'arg0', 'arg1',... 'argN'.

getComparator

IComparator getComparator()
                          throws ComparatorException
Get the comparator of the given element.

Returns:
The element comparator.
Throws:
ComparatorException - O comparator lookup errors.

getComparator

IComparator getComparator(IComparator comparatorDefault)
                          throws ComparatorException
Get the comparator of the given element.

Parameters:
comparatorDefault - The default comparator.
Returns:
The element comparator.
Throws:
ComparatorException - O comparator lookup errors.

getObject

Object getObject(IContext context,
                 boolean silent)
                 throws PluginException
Gets the corresponding value object.

Parameters:
context - The context.
silent - Flag to evaluate silently or not.
Returns:
The value object.
Throws:
PluginException - On plugin errors.

getObject

Object getObject(IContext context,
                 boolean silent,
                 IConverter converter,
                 List<String> arguments)
                 throws PluginException
Gets the corresponding value object.

Parameters:
context - The context.
silent - Flag to evaluate silently or not.
converter - The converter.
arguments - The arguments.
Returns:
The value object.
Throws:
PluginException - On plugin errors.

toXML

String toXML()
The XML representation.

Returns:
The XML version.


Copyright © 2014. All rights reserved.