public class TagAdapter extends 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.UnsupportedOperationException
- Must not be calledpublic void setParent(Tag parentTag)
setParent
in interface Tag
parentTag
- ignored.UnsupportedOperationException
- Must not be called.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
UnsupportedOperationException
- Must not be calledJspException
- never thrownBodyTag
public int doEndTag() throws JspException
doEndTag
in interface Tag
UnsupportedOperationException
- Must not be calledJspException
- never thrownpublic void release()
release
in interface Tag
UnsupportedOperationException
- Must not be calledComments to: jsp-dev@eclipse.org.
Copyright © 2019 Eclipse Foundation. All rights reserved.
Use is subject to license terms.