Package nl.gx.webmanager.taglib.util
Class ContainsPropertyTag
- java.lang.Object
-
- javax.servlet.jsp.tagext.SimpleTagSupport
-
- nl.gx.webmanager.taglib.util.ContainsPropertyTag
-
- All Implemented Interfaces:
javax.servlet.jsp.tagext.JspTag
,javax.servlet.jsp.tagext.SimpleTag
public class ContainsPropertyTag extends javax.servlet.jsp.tagext.SimpleTagSupport
Implements thecontainsProperty
tag. Checks whether the class specified by attributeobject
has a certain method that return property , which is specified by attributeproperty
. The result of the check can be placed in the pageContext under the key specified by the attributevar
. Example:<wmedit:containsProperty var="prop" object="${editcontext.baseObject}" property="propertyName" />
This tag checks if object class set with${editcontext.baseObject}
parameter contains getter method forpropertyName
parameter. Boolean value is converted to String and bind toprop
variable in the page context. This variable may later be used in page to, for example, display or omit parts of the page.- Author:
- md.pavkovic version 1.0
-
-
Constructor Summary
Constructors Constructor Description ContainsPropertyTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsProperty()
Check if Class contains getter method for attributeproperty
.void
doTag()
Sets the key in the pageContext specified by attributevar
Object
getObject()
Return the required object class attributeString
getProperty()
Returns the required property attribute.String
getVar()
Return the name of the variable to which the 'true' or 'false' value will be assigned or null if not set.void
setObject(Object object)
Setter for the required object attribute.void
setProperty(String property)
Setter for the required property attribute.void
setVar(String var)
Setter for the optional var attribute.
-
-
-
Method Detail
-
getVar
public String getVar()
Return the name of the variable to which the 'true' or 'false' value will be assigned or null if not set.- Returns:
- the var
-
setVar
public void setVar(String var)
Setter for the optional var attribute.- Parameters:
var
- the var to set
-
getObject
public Object getObject()
Return the required object class attribute- Returns:
- the object
-
setObject
public void setObject(Object object)
Setter for the required object attribute.- Parameters:
object
- the object to set
-
getProperty
public String getProperty()
Returns the required property attribute.- Returns:
- the property
-
setProperty
public void setProperty(String property)
Setter for the required property attribute.- Parameters:
property
- the property to set
-
containsProperty
public boolean containsProperty()
Check if Class contains getter method for attributeproperty
.- Returns:
true
if class contains getMethodName or isMethodName getter method for given property otherwise returnfalse
-
doTag
public void doTag() throws javax.servlet.jsp.JspException
Sets the key in the pageContext specified by attributevar
- Specified by:
doTag
in interfacejavax.servlet.jsp.tagext.SimpleTag
- Overrides:
doTag
in classjavax.servlet.jsp.tagext.SimpleTagSupport
- Throws:
javax.servlet.jsp.JspException
- See Also:
SimpleTag.doTag()
-
-