org.rhq.core.pluginapi.util
Class ObjectUtil

java.lang.Object
  extended by org.rhq.core.pluginapi.util.ObjectUtil

public class ObjectUtil
extends Object


Method Summary
static Object lookupAttributeProperty(Object obj, String propertyName)
          Returns the value of the property with the specified name for the given Object, or null if the Object has no such property.
static Object lookupDeepAttributeProperty(Object value, String propertyPath)
          Looks up deep object graph attributes using a dot delimited java bean spec style path.
static Double lookupDeepNumericAttributeProperty(Object value, String propertyPath)
          Reads a numeric value from a deep object graph as per ObjectUtil.lookupDeepAttributeProperty()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

lookupAttributeProperty

@Nullable
public static Object lookupAttributeProperty(Object obj,
                                                      String propertyName)
Returns the value of the property with the specified name for the given Object, or null if the Object has no such property.

Parameters:
obj - an Object
propertyName - the name of the property whose value should be returned
Returns:
the value of the property with the specified name for the given Object, or null if the Object has no such property

lookupDeepNumericAttributeProperty

public static Double lookupDeepNumericAttributeProperty(Object value,
                                                        String propertyPath)
Reads a numeric value from a deep object graph as per ObjectUtil.lookupDeepAttributeProperty()

Parameters:
value - The object to look into
propertyPath - the property path to search
Returns:
the double value read from the object's property path or Double.NaN if it can't be read

lookupDeepAttributeProperty

public static Object lookupDeepAttributeProperty(Object value,
                                                 String propertyPath)
Looks up deep object graph attributes using a dot delimited java bean spec style path. So if I have an object A with a Member object B with a String value C I can refer to it as "b.c" and pass in the object A and I'll get back the value of a.getB().getC()

Parameters:
value - The object to look into
propertyPath - the property path to search
Returns:
the value read from the object's property path


Copyright © 2008-2009 RHQ Project Advisory Board (Red Hat, Inc.). All Rights Reserved.