public abstract class TagHandler extends Object implements ITagHandler
Modifier and Type | Field and Description |
---|---|
protected HashMap<String,String> |
attributes |
protected ArrayList<ITagHandler> |
children |
protected ITagHandler |
parent |
Constructor and Description |
---|
TagHandler() |
Modifier and Type | Method and Description |
---|---|
HashMap<String,String> |
getAttributes() |
protected Boolean |
getBooleanAttribute(String attributeName,
IGramarContext context)
Get the boolean value of the given property name.
|
protected Boolean |
getBooleanAttribute(String attributeName,
IGramarContext context,
boolean defaultValue)
Get the boolean value of the given property name.
|
List<ITagHandler> |
getChildren() |
protected Integer |
getIntegerAttribute(String attributeName,
IGramarContext context)
Get the integer value of the given property name.
|
protected Integer |
getIntegerAttribute(String attributeName,
IGramarContext context,
int defaultValue)
Get the integer value of the given property name.
|
protected Node |
getNodeAttribute(String attributeName,
IGramarContext context)
Get the Node that is the result of evaluating the given property name as an XPath expression.
|
protected Node[] |
getNodesAttribute(String attributeName,
IGramarContext context)
Get an array of Nodes that is the result of evaluating the given property name as an XPath expression.
|
protected Object |
getObjectAttribute(String attributeName,
IGramarContext context)
Get the Object that is the result of evaluating the given property name as an XPath expression.
|
ITagHandler |
getParent() |
protected String |
getRawAttribute(String attributeName)
Get the raw String value of the given property name.
|
protected String |
getRawAttribute(String attributeName,
String defaultValue)
Get the raw String value of the given property name.
|
protected String |
getStringAttribute(String attributeName,
IGramarContext context)
Get the String value of the given property name.
|
protected String |
getStringAttribute(String attributeName,
IGramarContext context,
String defaultValue)
Get the String value of the given property name.
|
abstract String |
getTagName() |
ITagHandler |
glomUsing(SourceRegion region,
IGramarContext context) |
ITagHandler |
parentNamed(String name)
Answers the first parent (direct or indirect) with the given tag name
|
MergeStream |
processChildren(IGramarContext context)
Create a new stream and merge all of the receiver's child handlers
with that stream.
|
void |
processChildren(MergeStream stream,
IGramarContext context)
Merge all of the receiver's child handlers with the given stream
|
void |
setAttributes(HashMap<String,String> attributes) |
void |
setParent(ITagHandler parent) |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
mergeTo
protected ITagHandler parent
protected ArrayList<ITagHandler> children
public ITagHandler glomUsing(SourceRegion region, IGramarContext context) throws GramarException
glomUsing
in interface ITagHandler
GramarException
public abstract String getTagName()
public List<ITagHandler> getChildren()
getChildren
in interface ITagHandler
public ITagHandler getParent()
getParent
in interface ITagHandler
public void setParent(ITagHandler parent)
setParent
in interface ITagHandler
public void setAttributes(HashMap<String,String> attributes)
setAttributes
in interface ITagHandler
public void processChildren(MergeStream stream, IGramarContext context)
public MergeStream processChildren(IGramarContext context)
public ITagHandler parentNamed(String name)
parentNamed
in interface ITagHandler
protected Boolean getBooleanAttribute(String attributeName, IGramarContext context, boolean defaultValue) throws XPathExpressionException
attributeName
- context
- defaultValue
- XPathExpressionException
protected Boolean getBooleanAttribute(String attributeName, IGramarContext context) throws XPathExpressionException, MissingRequiredAttributeException
attributeName
- context
- defaultValue
- XPathExpressionException
MissingRequiredAttributeException
protected Integer getIntegerAttribute(String attributeName, IGramarContext context, int defaultValue) throws XPathExpressionException
attributeName
- context
- defaultValue
- XPathExpressionException
protected Integer getIntegerAttribute(String attributeName, IGramarContext context) throws XPathExpressionException, MissingRequiredAttributeException
attributeName
- context
- defaultValue
- XPathExpressionException
MissingRequiredAttributeException
protected String getStringAttribute(String attributeName, IGramarContext context, String defaultValue) throws XPathExpressionException
attributeName
- context
- defaultValue
- XPathExpressionException
protected String getStringAttribute(String attributeName, IGramarContext context) throws XPathExpressionException, MissingRequiredAttributeException
attributeName
- context
- defaultValue
- XPathExpressionException
MissingRequiredAttributeException
protected String getRawAttribute(String attributeName, String defaultValue)
attributeName
- context
- defaultValue
- XPathExpressionException
protected String getRawAttribute(String attributeName) throws MissingRequiredAttributeException
attributeName
- context
- defaultValue
- XPathExpressionException
MissingRequiredAttributeException
protected Object getObjectAttribute(String attributeName, IGramarContext context) throws MissingRequiredAttributeException, XPathExpressionException
attributeName
- context
- MissingRequiredAttributeException
XPathExpressionException
protected Node getNodeAttribute(String attributeName, IGramarContext context) throws MissingRequiredAttributeException, XPathExpressionException
attributeName
- context
- MissingRequiredAttributeException
XPathExpressionException
protected Node[] getNodesAttribute(String attributeName, IGramarContext context) throws MissingRequiredAttributeException, XPathExpressionException
attributeName
- context
- MissingRequiredAttributeException
XPathExpressionException
Copyright © 2015. All rights reserved.