public class TagAdapter extends java.lang.Object implements Tag
Because SimpleTag does not extend Tag, and because Tag.setParent() only accepts a Tag instance, a classic tag handler (one that implements Tag) cannot have a SimpleTag as its parent. To remedy this, a TagAdapter is created to wrap the SimpleTag parent, and the adapter is passed to setParent() instead. A classic Tag Handler can call getAdaptee() to retrieve the encapsulated SimpleTag instance.
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
Constructor and Description |
---|
TagAdapter(SimpleTag adaptee)
Creates a new TagAdapter that wraps the given SimpleTag and returns the parent tag when getParent() is called.
|
Modifier and Type | Method and Description |
---|---|
int |
doEndTag()
Must not be called.
|
int |
doStartTag()
Must not be called.
|
JspTag |
getAdaptee()
Gets the tag that is being adapted to the Tag interface.
|
Tag |
getParent()
Returns the parent of this tag, which is always getAdaptee().getParent().
|
void |
release()
Must not be called.
|
void |
setPageContext(PageContext pc)
Must not be called.
|
void |
setParent(Tag parentTag)
Must not be called.
|
public TagAdapter(SimpleTag adaptee)
adaptee
- The SimpleTag being adapted as a Tag.public void setPageContext(PageContext pc)
setPageContext
in interface Tag
pc
- ignored.java.lang.UnsupportedOperationException
- Must not be calledpublic void setParent(Tag parentTag)
public Tag getParent()
getParent
in interface Tag
TagSupport.findAncestorWithClass(javax.servlet.jsp.tagext.Tag, java.lang.Class)
public JspTag getAdaptee()
public int doStartTag() throws JspException
doStartTag
in interface Tag
java.lang.UnsupportedOperationException
- Must not be calledJspException
- never thrownBodyTag
public int doEndTag() throws JspException
doEndTag
in interface Tag
java.lang.UnsupportedOperationException
- Must not be calledJspException
- never thrown