Package org.apache.commons.jelly
Class TagSupport
java.lang.Object
org.apache.commons.jelly.TagSupport
- All Implemented Interfaces:
Tag
- Direct Known Subclasses:
BaseClassLoaderTag,BreakTag,CaseTag,CatchTag,ChooseTag,DefaultTag,DynaTagSupport,ExprTag,FileTag,ForEachTag,GetStaticTag,IfTag,ImportTag,IncludeTag,InvokeStaticTag,InvokeTag,JellyTag,MuteTag,OtherwiseTag,ParseTag,RemoveTag,ScopeTag,SetTag,SwitchTag,ThreadTag,WhenTag,WhileTag,WhitespaceTag,XPathTagSupport
TagSupport an abstract base class which is useful to
inherit from if developing your own tag.
- Version:
- $Revision: 155420 $
- Author:
- James Strachan
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected TagfindAncestorWithClass(Class parentClass) Searches up the parent hierarchy for a Tag of the given type.protected TagfindAncestorWithClass(Class[] parentClasses) Searches up the parent hierarchy for a Tag of one of the given types.protected TagfindAncestorWithClass(Collection parentClasses) Searches up the parent hierarchy for a Tag of one of the given types.static TagfindAncestorWithClass(Tag from, Class tagClass) Searches up the parent hierarchy from the given tag for a Tag of the given typestatic TagfindAncestorWithClass(Tag from, Class[] tagClasses) Searches up the parent hierarchy from the given tag for a Tag matching one or more of given types.static TagfindAncestorWithClass(Tag from, Collection tagClasses) Searches up the parent hierarchy from the given tag for a Tag matching one or more of given types.getBody()protected StringExecutes the body of the tag and returns the result as a String.protected StringgetBodyText(boolean shouldEscape) Executes the body of the tag and returns the result as a String.Gets the context in which the tag will be runvoidinvokeBody(XMLOutput output) Invokes the body of this tag using the given outputbooleanReturns whether the body of this tag will be escaped or not.booleanisTrim()Deprecated.Trimming is now handled during parsing of the script, like it does in XSLT.voidSets the body of the tagvoidsetContext(JellyContext context) Sets the context in which the tag will be runvoidsetEscapeText(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.voidSets the parent of this tagvoidsetTrim(boolean shouldTrim) Deprecated.Trimming is now handled during parsing of the script, like it does in XSLT.protected voidtrimBody()Deprecated.Trimming is now handled during parsing of the script, like it does in XSLT.
-
Field Details
-
parent
the parent of this tag -
body
the body of the tag -
context
The current context
-
-
Constructor Details
-
TagSupport
public TagSupport() -
TagSupport
public TagSupport(boolean shouldTrim)
-
-
Method Details
-
findAncestorWithClass
Searches up the parent hierarchy from the given tag for a Tag of the given type- Parameters:
from- the tag to start searching fromtagClass- the type of the tag to find- Returns:
- the tag of the given type or null if it could not be found
-
findAncestorWithClass
Searches up the parent hierarchy from the given tag for a Tag matching one or more of given types.- Parameters:
from- the tag to start searching fromtagClasses- a Collection of Class types that might match- Returns:
- the tag of the given type or null if it could not be found
-
findAncestorWithClass
Searches up the parent hierarchy from the given tag for a Tag matching one or more of given types.- Parameters:
from- the tag to start searching fromtagClasses- an array of types that might match- Returns:
- the tag of the given type or null if it could not be found
- See Also:
-
setTrim
public void setTrim(boolean shouldTrim) Deprecated.Trimming is now handled during parsing of the script, like it does in XSLT.Sets whether whitespace inside this tag should be trimmed or not. Defaults to true so whitespace is trimmed -
isTrim
public boolean isTrim()Deprecated.Trimming is now handled during parsing of the script, like it does in XSLT. -
getParent
-
setParent
Sets the parent of this tag -
getBody
-
setBody
Sets the body of the tag -
getContext
Description copied from interface:TagGets the context in which the tag will be run- Specified by:
getContextin interfaceTag- Returns:
- the context in which the tag will be run
-
setContext
Sets the context in which the tag will be run- Specified by:
setContextin interfaceTag- Throws:
JellyTagException
-
invokeBody
Invokes the body of this tag using the given output- Specified by:
invokeBodyin interfaceTag- Throws:
JellyTagException
-
findAncestorWithClass
Searches up the parent hierarchy for a Tag of the given type.- Returns:
- the tag of the given type or null if it could not be found
-
findAncestorWithClass
Searches up the parent hierarchy for a Tag of one of the given types.- Returns:
- the tag of the given type or null if it could not be found
- See Also:
-
findAncestorWithClass
Searches up the parent hierarchy for a Tag of one of the given types.- Returns:
- the tag of the given type or null if it could not be found
-
getBodyText
Executes the body of the tag and returns the result as a String.- Returns:
- the text evaluation of the body
- Throws:
JellyTagException
-
getBodyText
Executes the body of the tag and returns the result as a String.- Parameters:
shouldEscape- Signal if the text should be escaped.- Returns:
- the text evaluation of the body
- Throws:
JellyTagException
-
trimBody
protected void trimBody()Deprecated.Trimming is now handled during parsing of the script, like it does in XSLT.Find all text nodes inside the top level of this body and if they are just whitespace then remove them -
isEscapeText
public boolean isEscapeText()Returns whether the body of this tag will be escaped or not. -
setEscapeText
public 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.
-