nl.gx.webmanager.taglib.util
Class ContainsPropertyTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.SimpleTagSupport
      extended by 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 the containsProperty tag. Checks whether the class specified by attribute object has a certain method that return property , which is specified by attribute property. The result of the check can be placed in the pageContext under the key specified by the attribute var. Example:

        <wmedit:containsProperty var="prop" object="${editcontext.baseObject}" 
                                          property="propertyName" /> 
 
This tag checks if object class set with ${editcontext.baseObject} parameter contains getter method for propertyName parameter. Boolean value is converted to String and bind to prop 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
ContainsPropertyTag()
           
 
Method Summary
 boolean containsProperty()
          Check if Class contains getter method for attribute property.
 void doTag()
          Sets the key in the pageContext specified by attribute var
 java.lang.Object getObject()
          Return the required object class attribute
 java.lang.String getProperty()
          Returns the required property attribute.
 java.lang.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(java.lang.Object object)
          Setter for the required object attribute.
 void setProperty(java.lang.String property)
          Setter for the required property attribute.
 void setVar(java.lang.String var)
          Setter for the optional var attribute.
 
Methods inherited from class javax.servlet.jsp.tagext.SimpleTagSupport
findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setJspContext, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContainsPropertyTag

public ContainsPropertyTag()
Method Detail

getVar

public java.lang.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(java.lang.String var)
Setter for the optional var attribute.

Parameters:
var - the var to set

getObject

public java.lang.Object getObject()
Return the required object class attribute

Returns:
the object

setObject

public void setObject(java.lang.Object object)
Setter for the required object attribute.

Parameters:
object - the object to set

getProperty

public java.lang.String getProperty()
Returns the required property attribute.

Returns:
the property

setProperty

public void setProperty(java.lang.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 attribute property.

Returns:
true if class contains getMethodName or isMethodName getter method for given property otherwise return false

doTag

public void doTag()
           throws javax.servlet.jsp.JspException
Sets the key in the pageContext specified by attribute var

Specified by:
doTag in interface javax.servlet.jsp.tagext.SimpleTag
Overrides:
doTag in class javax.servlet.jsp.tagext.SimpleTagSupport
Throws:
javax.servlet.jsp.JspException
See Also:
SimpleTag.doTag()


Copyright © 2007-2011 GX Software BV. All Rights Reserved.