Class ContentProviderUtils

java.lang.Object
com.webmethods.caf.faces.data.ContentProviderUtils

public class ContentProviderUtils extends Object
Utility functions for content providers. Should not be used by clients directly.
  • Constructor Details

    • ContentProviderUtils

      public ContentProviderUtils()
  • Method Details

    • getPropertyKeys

      public static Object[] getPropertyKeys(Object o)
      Returns property keys for object.
      Parameters:
      o - Object containing the properties
      Returns:
      Object[] of all the property keys
    • getType

      public static Class<?> getType(Object o, Object propertyKey) throws PropertyNotFoundException
      Returns property type for object.
      Parameters:
      o - Object containing the property
      propertyKey - the property key of type String or Integer
      Returns:
      Class of the property
      Throws:
      PropertyNotFoundException - if the object does not have the propertyKey
    • getType

      public static Class<?> getType(Class<?> c, Object propertyKey) throws PropertyNotFoundException
      Returns property type for a class.
      Parameters:
      c - Class containing the property
      propertyKey - the property key of type String or Integer
      Returns:
      Class of the property
      Throws:
      PropertyNotFoundException - if the class does not have the propertyKey
    • getValue

      public static Object getValue(Object o, Object propertyKey) throws ELException, PropertyNotFoundException
      Returns property value for object.
      Parameters:
      o - Object containing the property
      propertyKey - the property key of type String or Integer
      Returns:
      Object value against the property
      Throws:
      EvaluationException - if error during property evaluation
      PropertyNotFoundException - if the object does not have the propertyKey
      ELException
    • hasProperty

      public static boolean hasProperty(Object o, Object propertyKey)
      Checks if a property exists for object.
      Parameters:
      o - Object containing the property
      propertyKey - the property key of type String or Integer
      Returns:
      true if the property exists, false otherwise
    • hasProperty

      public static boolean hasProperty(Class<?> c, Object propertyKey)
      Checks if a property exists for a Class.
      Parameters:
      o - Class containing the property
      propertyKey - the property key of type String or Integer
      Returns:
      true if the property exists, false otherwise
    • isReadOnly

      public static boolean isReadOnly(Object o, Object propertyKey) throws ELException, PropertyNotFoundException
      Checks if a property is editable for a object.
      Parameters:
      o - Object containing the property
      propertyKey - the property key of type String or Integer
      Returns:
      true if the property is editable, false otherwise
      Throws:
      PropertyNotFoundException - if the object does not have the propertyKey
      ELException
    • isReadOnly

      public static boolean isReadOnly(Class<?> c, Object propertyKey) throws PropertyNotFoundException
      Checks if a property is editable for a Class .
      Parameters:
      o - Class containing the property
      propertyKey - the property key of type String or Integer
      Returns:
      true if the property is editable, false otherwise
      Throws:
      PropertyNotFoundException - if the object does not have the propertyKey
    • setValue

      public static void setValue(Object o, Object propertyKey, Object value) throws ELException, PropertyNotFoundException
      Set value for property in an object.
      Parameters:
      o - Object containing the property
      propertyKey - the property key of type String or Integer
      value - Object value against the property
      Throws:
      EvaluationException - if error during property evaluation
      PropertyNotFoundException - if the object does not have the propertyKey
      ELException
    • evaluateBinding

      @Deprecated public static Object evaluateBinding(Object provider, String providerVariable, ValueBinding binding)
      Evaluates the specified binding in the context of the specified content provider, using the specified provider variable.
      Parameters:
      provider - content provider
      providerVariable - provider variable
      binding - ValueBinding
      Returns:
      the evaluated value
    • evaluateBinding

      public static Object evaluateBinding(Object provider, String providerVariable, ValueExpression binding)
      Evaluates the specified binding in the context of the specified content provider, using the specified provider variable.
      Parameters:
      provider - content provider
      providerVariable - provider variable
      binding - ValueBinding
      Returns:
      the evaluated value
    • evaluateRowBinding

      @Deprecated public static Object evaluateRowBinding(ITableContentProvider table, ValueBinding binding)
      Evaluates the specified binding in the context of the specified table's current row, using the the row variable specified by ITableContentProvider.getRowVariable().
      Parameters:
      table - ITableContentProvider
      binding - ValueBinding
      Returns:
      the evaluated value
    • evaluateRowBinding

      public static Object evaluateRowBinding(ITableContentProvider table, ValueExpression binding)
      Evaluates the specified binding in the context of the specified table's current row, using the the row variable specified by ITableContentProvider.getRowVariable().
      Parameters:
      table - ITableContentProvider
      binding - ValueBinding
      Returns:
      the evaluated value
    • getPropertyDescriptor

      public static PropertyDescriptor getPropertyDescriptor(Class<?> c, Object propertyKey)
      Get descriptor for property specified by name.
      Parameters:
      c - Class containing the property
      propertyKey - the property key of type String or Integer
      Returns:
      PropertyDescriptor, or null if not found.