Package org.apache.struts.faces.util
Class Utils
java.lang.Object
org.apache.struts.faces.util.Utils
This class has some static utils-methods.
- Since:
- Struts 1.4.1
- Author:
- Stefan Graff
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
Returns the value of a map as expected class.static void
setActionListenerProperty
(UIComponent component, MethodExpression actionListener) If the specified action-listener is notnull
use it to add the action-listener to the component.static void
setActionProperty
(UIComponent component, MethodExpression action) If the specified action is notnull
use it to set the action of the component.static void
setBooleanProperty
(UIComponent component, String propName, ValueExpression value) If the specified attribute value is notnull
use it to either store a value binding expression for the specified attribute name, or store it as the literal value of the attribute.static void
setBooleanProperty
(UIComponent component, String propName, ValueExpression value, Boolean defaultValue) If the specified attribute value is notnull
use it to either store a value binding expression for the specified attribute name, or store it as the literal value of the attribute.static void
setIntegerProperty
(UIComponent component, String propName, ValueExpression value) If the specified attribute value is notnull
use it to either store a value binding expression for the specified attribute name, or store it as the literal value of the attribute.static void
setIntegerProperty
(UIComponent component, String propName, ValueExpression value, Integer defaultValue) If the specified attribute value is notnull
use it to either store a value binding expression for the specified attribute name, or store it as the literal value of the attribute.static void
setStringProperty
(UIComponent component, String propName, ValueExpression value) If the specified attribute value is notnull
use it to either store a value binding expression for the specified attribute name, or store it as the literal value of the attribute.static void
setStringProperty
(UIComponent component, String propName, ValueExpression value, String defaultValue) If the specified attribute value is notnull
use it to either store a value binding expression for the specified attribute name, or store it as the literal value of the attribute.
-
Method Details
-
setBooleanProperty
public static void setBooleanProperty(UIComponent component, String propName, ValueExpression value) If the specified attribute value is notnull
use it to either store a value binding expression for the specified attribute name, or store it as the literal value of the attribute.- Parameters:
component
-UIComponent
whose attribute is to be setpropName
- Property namevalue
- Property value (ornull
)- Throws:
ELException
- if the expression has invalid syntax- Since:
- 1.4.1
-
setBooleanProperty
public static void setBooleanProperty(UIComponent component, String propName, ValueExpression value, Boolean defaultValue) If the specified attribute value is notnull
use it to either store a value binding expression for the specified attribute name, or store it as the literal value of the attribute.- Parameters:
component
-UIComponent
whose attribute is to be setpropName
- Property namevalue
- Property value (ornull
)defaultValue
- When notnull
the default-value- Throws:
ELException
- if the expression has invalid syntax- Since:
- 1.4.3
-
setStringProperty
If the specified attribute value is notnull
use it to either store a value binding expression for the specified attribute name, or store it as the literal value of the attribute.- Parameters:
component
-UIComponent
whose attribute is to be setpropName
- Property namevalue
- Property value (ornull
)- Throws:
ELException
- if the expression has invalid syntax- Since:
- 1.4.1
-
setStringProperty
public static void setStringProperty(UIComponent component, String propName, ValueExpression value, String defaultValue) If the specified attribute value is notnull
use it to either store a value binding expression for the specified attribute name, or store it as the literal value of the attribute.- Parameters:
component
-UIComponent
whose attribute is to be setpropName
- Property namevalue
- Property value (ornull
)defaultValue
- When notnull
the default-value- Throws:
ELException
- if the expression has invalid syntax- Since:
- 1.4.3
-
setIntegerProperty
public static void setIntegerProperty(UIComponent component, String propName, ValueExpression value) If the specified attribute value is notnull
use it to either store a value binding expression for the specified attribute name, or store it as the literal value of the attribute.- Parameters:
component
-UIComponent
whose attribute is to be setpropName
- Property namevalue
- Property value (ornull
)- Throws:
ELException
- if the expression has invalid syntax- Since:
- 1.4.1
-
setIntegerProperty
public static void setIntegerProperty(UIComponent component, String propName, ValueExpression value, Integer defaultValue) If the specified attribute value is notnull
use it to either store a value binding expression for the specified attribute name, or store it as the literal value of the attribute.- Parameters:
component
-UIComponent
whose attribute is to be setpropName
- Property namevalue
- Property value (ornull
)defaultValue
- When notnull
the default-value- Throws:
ELException
- if the expression has invalid syntax- Since:
- 1.4.3
-
setActionProperty
If the specified action is notnull
use it to set the action of the component.- Parameters:
component
-UIComponent
whose action is to be setaction
- the Action- Throws:
IllegalArgumentException
- if the component is not an instance ofActionSource2
- Since:
- 1.4.1
-
setActionListenerProperty
public static void setActionListenerProperty(UIComponent component, MethodExpression actionListener) If the specified action-listener is notnull
use it to add the action-listener to the component.- Parameters:
component
-UIComponent
whose action-listener is to be addedactionListener
- the Action-Listener- Throws:
IllegalArgumentException
- if the component is not an instance ofActionSource2
- Since:
- 1.4.1
-
getMapValue
Returns the value of a map as expected class.- Type Parameters:
T
- the expected class- Parameters:
clazz
- the expected classmap
- the map with the valueskey
- the key to access the map- Returns:
- the value as expected class
- Throws:
ClassCastException
- if the key is of an inappropriate type for this map or if the value is not null and is not assignable to the type T.NullPointerException
- if the specified key is null and this map does not permit null keys.
-