Class Utils

java.lang.Object
org.apache.struts.faces.util.Utils

public class Utils extends Object
This class has some static utils-methods.
Since:
Struts 1.4.1
Author:
Stefan Graff
  • Method Details

    • setBooleanProperty

      public static void setBooleanProperty(UIComponent component, String propName, ValueExpression value)
      If the specified attribute value is not null 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 set
      propName - Property name
      value - Property value (or null)
      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 not null 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 set
      propName - Property name
      value - Property value (or null)
      defaultValue - When not null the default-value
      Throws:
      ELException - if the expression has invalid syntax
      Since:
      1.4.3
    • setStringProperty

      public static void setStringProperty(UIComponent component, String propName, ValueExpression value)
      If the specified attribute value is not null 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 set
      propName - Property name
      value - Property value (or null)
      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 not null 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 set
      propName - Property name
      value - Property value (or null)
      defaultValue - When not null 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 not null 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 set
      propName - Property name
      value - Property value (or null)
      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 not null 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 set
      propName - Property name
      value - Property value (or null)
      defaultValue - When not null the default-value
      Throws:
      ELException - if the expression has invalid syntax
      Since:
      1.4.3
    • setActionProperty

      public static void setActionProperty(UIComponent component, MethodExpression action)
      If the specified action is not null use it to set the action of the component.
      Parameters:
      component - UIComponent whose action is to be set
      action - the Action
      Throws:
      IllegalArgumentException - if the component is not an instance of ActionSource2
      Since:
      1.4.1
    • setActionListenerProperty

      public static void setActionListenerProperty(UIComponent component, MethodExpression actionListener)
      If the specified action-listener is not null use it to add the action-listener to the component.
      Parameters:
      component - UIComponent whose action-listener is to be added
      actionListener - the Action-Listener
      Throws:
      IllegalArgumentException - if the component is not an instance of ActionSource2
      Since:
      1.4.1
    • getMapValue

      public static <T> T getMapValue(Class<T> clazz, Map<String,Object> map, String key)
      Returns the value of a map as expected class.
      Type Parameters:
      T - the expected class
      Parameters:
      clazz - the expected class
      map - the map with the values
      key - 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.