net.craftforge.reflection.utils
Class PropertyUtils
java.lang.Object
net.craftforge.reflection.utils.PropertyUtils
public class PropertyUtils
- extends Object
- Since:
- 02.12.2010
- Author:
- Christian Bick
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PropertyUtils
public PropertyUtils()
setProperty
public static Object setProperty(Object owner,
Field field,
Object value)
throws NoSuchMethodException,
InvocationTargetException,
IllegalAccessException
- Sets the value of an object's property.
If the field is public, the new value will be assigned to field directly.
Otherwise, a setter method will be looked up and invoked with the value to set.
- Parameters:
owner - The object that owns the propertyfield - The property fieldvalue - The value to set
- Returns:
- The modified object
- Throws:
IllegalAccessException - Failed to access field or setter method
NoSuchMethodException - Setter method not found
InvocationTargetException - Failed to invoke setter method
getProperty
public static Object getProperty(Object owner,
Field field)
throws IllegalAccessException,
NoSuchMethodException,
InvocationTargetException
- Gets the value of an object's property.
- Parameters:
owner - The objectfield - The property field
- Returns:
- The value of the property
- Throws:
IllegalAccessException - Failed to access field or getter method
NoSuchMethodException - Getter method not found
InvocationTargetException - Failed to invoke getter method
Copyright © 2011. All Rights Reserved.