public abstract class TagSupport extends Object implements Tag
TagSupport
an abstract base class which is useful to
inherit from if developing your own tag.
Modifier and Type | Field and Description |
---|---|
protected Script |
body
the body of the tag
|
protected JellyContext |
context
The current context
|
protected Tag |
parent
the parent of this tag
|
Constructor and Description |
---|
TagSupport() |
TagSupport(boolean shouldTrim) |
Modifier and Type | Method and Description |
---|---|
protected Tag |
findAncestorWithClass(Class parentClass)
Searches up the parent hierarchy for a Tag of the given type.
|
protected Tag |
findAncestorWithClass(Class[] parentClasses)
Searches up the parent hierarchy for a Tag of one of the given types.
|
protected Tag |
findAncestorWithClass(Collection parentClasses)
Searches up the parent hierarchy for a Tag of one of the given types.
|
static Tag |
findAncestorWithClass(Tag from,
Class tagClass)
Searches up the parent hierarchy from the given tag
for a Tag of the given type
|
static Tag |
findAncestorWithClass(Tag from,
Class[] tagClasses)
Searches up the parent hierarchy from the given tag
for a Tag matching one or more of given types.
|
static Tag |
findAncestorWithClass(Tag from,
Collection tagClasses)
Searches up the parent hierarchy from the given tag
for a Tag matching one or more of given types.
|
Script |
getBody() |
protected String |
getBodyText()
Executes the body of the tag and returns the result as a String.
|
protected String |
getBodyText(boolean shouldEscape)
Executes the body of the tag and returns the result as a String.
|
JellyContext |
getContext()
Gets the context in which the tag will be run
|
Tag |
getParent() |
void |
invokeBody(XMLOutput output)
Invokes the body of this tag using the given output
|
boolean |
isEscapeText()
Returns whether the body of this tag will be escaped or not.
|
boolean |
isTrim()
Deprecated.
Trimming is now handled during parsing of the script, like it does in XSLT.
|
void |
setBody(Script body)
Sets the body of the tag
|
void |
setContext(JellyContext context)
Sets the context in which the tag will be run
|
void |
setEscapeText(boolean escapeText)
Sets whether the body of the tag should be escaped as text (so that < and > are
escaped as < and >), which is the default or leave the text as XML.
|
void |
setParent(Tag parent)
Sets the parent of this tag
|
void |
setTrim(boolean shouldTrim)
Deprecated.
Trimming is now handled during parsing of the script, like it does in XSLT.
|
protected void |
trimBody()
Deprecated.
Trimming is now handled during parsing of the script, like it does in XSLT.
|
protected Tag parent
protected Script body
protected JellyContext context
public static Tag findAncestorWithClass(Tag from, Class tagClass)
from
- the tag to start searching fromtagClass
- the type of the tag to findpublic static Tag findAncestorWithClass(Tag from, Collection tagClasses)
from
- the tag to start searching fromtagClasses
- a Collection of Class types that might matchpublic static Tag findAncestorWithClass(Tag from, Class[] tagClasses)
from
- the tag to start searching fromtagClasses
- an array of types that might matchfindAncestorWithClass(Tag,Collection)
public void setTrim(boolean shouldTrim)
public boolean isTrim()
public Tag getParent()
public void setParent(Tag parent)
public void setBody(Script body)
public JellyContext getContext()
Tag
getContext
in interface Tag
public void setContext(JellyContext context) throws JellyTagException
setContext
in interface Tag
JellyTagException
public void invokeBody(XMLOutput output) throws JellyTagException
invokeBody
in interface Tag
JellyTagException
protected Tag findAncestorWithClass(Class parentClass)
protected Tag findAncestorWithClass(Class[] parentClasses)
findAncestorWithClass(Collection)
protected Tag findAncestorWithClass(Collection parentClasses)
protected String getBodyText() throws JellyTagException
JellyTagException
protected String getBodyText(boolean shouldEscape) throws JellyTagException
shouldEscape
- Signal if the text should be escaped.JellyTagException
protected void trimBody()
public boolean isEscapeText()
public void setEscapeText(boolean escapeText)
Copyright © 2014 Apache Software Foundation. All rights reserved.