org.gmetrics.util
Class PropertyUtil

java.lang.Object
  extended by org.gmetrics.util.PropertyUtil
All Implemented Interfaces:
groovy.lang.GroovyObject

public class PropertyUtil
extends java.lang.Object
implements groovy.lang.GroovyObject

Contains property-related static utility methods

Version:
$Revision: 24 $ - $Date: 2009-12-10 21:17:05 -0500 (Thu, 10 Dec 2009) $
Author:
Chris Mair

Method Summary
 groovy.lang.MetaClass getMetaClass()
           
 java.lang.Object getProperty(java.lang.String name)
           
 java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)
           
 void setMetaClass(groovy.lang.MetaClass metaClass)
           
 void setProperty(java.lang.String name, java.lang.Object value)
           
static void setPropertyFromString(java.lang.Object object, java.lang.String propertyName, java.lang.String propertyValue)
          Set the value of the named property on the specified Object from a String value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setPropertyFromString

public static void setPropertyFromString(java.lang.Object object,
                                         java.lang.String propertyName,
                                         java.lang.String propertyValue)
Set the value of the named property on the specified Object from a String value. If the name specifies an int, long or boolean value then parse the provided String value and convert to the appropriate type.

Parameters:
object - - the Object whose field should be set
name - - the property name to set
value - - the property value as a String
Throws:
java.lang.NoSuchFieldException - - if the object does not contain the named field

getMetaClass

public groovy.lang.MetaClass getMetaClass()
Specified by:
getMetaClass in interface groovy.lang.GroovyObject

setMetaClass

public void setMetaClass(groovy.lang.MetaClass metaClass)
Specified by:
setMetaClass in interface groovy.lang.GroovyObject

invokeMethod

public java.lang.Object invokeMethod(java.lang.String name,
                                     java.lang.Object args)
Specified by:
invokeMethod in interface groovy.lang.GroovyObject

getProperty

public java.lang.Object getProperty(java.lang.String name)
Specified by:
getProperty in interface groovy.lang.GroovyObject

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Specified by:
setProperty in interface groovy.lang.GroovyObject


Copyright © 2010. All Rights Reserved.