org.jppf.serialization
Class ReflectionHelper

java.lang.Object
  extended by org.jppf.serialization.ReflectionHelper

public final class ReflectionHelper
extends Object

Author:
Laurent Cohen

Constructor Summary
ReflectionHelper()
           
 
Method Summary
static Class<?> getNonArrayTypeFromSignature(String signature, ClassLoader cl)
          Lookup or load the non-array class based on the sepcified signature.
static Field[] getNonTransientFields(Class<?> clazz)
          Get all declared non-transient fields of the given class.
static Method getReadObjectMethod(Class<?> clazz)
          Determine whether the specified class has a writeObject() method with the signature specified in Serializable.
static String getSignatureFromType(Class<?> clazz)
          Get a unique string representation for the specified type.
static Method getWriteObjectMethod(Class<?> clazz)
          Determine whether the specified class has a writeObject() method with the signature specified in Serializable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionHelper

public ReflectionHelper()
Method Detail

getNonTransientFields

public static Field[] getNonTransientFields(Class<?> clazz)
                                     throws Exception
Get all declared non-transient fields of the given class.

Parameters:
clazz - the class object from whch to extract the fields.
Returns:
an array of Field objects.
Throws:
Exception - if any error occurs.

getSignatureFromType

public static String getSignatureFromType(Class<?> clazz)
                                   throws Exception
Get a unique string representation for the specified type.

Parameters:
clazz - the type from which to get the signature.
Returns:
a string representing the ytpe.
Throws:
Exception - if any error occurs.

getNonArrayTypeFromSignature

public static Class<?> getNonArrayTypeFromSignature(String signature,
                                                    ClassLoader cl)
                                             throws Exception
Lookup or load the non-array class based on the sepcified signature.

Parameters:
signature - the class signature.
cl - the class laoder used to load the class.
Returns:
a Class object.
Throws:
Exception - if any error occurs.

getWriteObjectMethod

public static Method getWriteObjectMethod(Class<?> clazz)
                                   throws Exception
Determine whether the specified class has a writeObject() method with the signature specified in Serializable.

Parameters:
clazz - the class to check.
Returns:
true if the class has a writeObject() method, false otherwise.
Throws:
Exception - if any error occurs.

getReadObjectMethod

public static Method getReadObjectMethod(Class<?> clazz)
                                  throws Exception
Determine whether the specified class has a writeObject() method with the signature specified in Serializable.

Parameters:
clazz - the class to check.
Returns:
true if the class has a writeObject() method, false otherwise.
Throws:
Exception - if any error occurs.


Copyright © 2005-2010 JPPF Team.