com.atlassian.plugins.rest.common.util
Class ReflectionUtils

java.lang.Object
  extended by com.atlassian.plugins.rest.common.util.ReflectionUtils

public class ReflectionUtils
extends java.lang.Object

A class to simplify some reflection calls.


Constructor Summary
ReflectionUtils()
           
 
Method Summary
static java.lang.Object getFieldValue(java.lang.reflect.Field field, java.lang.Object object)
          Gets the value of the field for the given object.
static void setFieldValue(java.lang.reflect.Field field, java.lang.Object object, java.lang.Object value)
          Sets the value of the field for the given object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionUtils

public ReflectionUtils()
Method Detail

getFieldValue

public static java.lang.Object getFieldValue(java.lang.reflect.Field field,
                                             java.lang.Object object)
Gets the value of the field for the given object. It will change the accessibility of the field if necessary. Setting it back to its original value at the end of the method call.

Parameters:
field - the field to read from
object - the object to read the field from
Returns:
the value of the field.

setFieldValue

public static void setFieldValue(java.lang.reflect.Field field,
                                 java.lang.Object object,
                                 java.lang.Object value)
Sets the value of the field for the given object. It will change the accessibility of the field if necessary. Setting it back to its original value at the end of the method call.

Parameters:
field - the field to set the value of
object - the object to for which to set the field value.
value - the new value to be set to the field of object.


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.