Package org.jppf.serialization
Class SerializationReflectionHelper
java.lang.Object
org.jppf.serialization.SerializationReflectionHelper
This helper class provides utility methods to facilitate the JPPF-sepcific serialization and deserilaization.
- Author:
- Laurent Cohen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectCreate an object without calling any of its class constructors if the JVM supports it, or failing that, attempt to call the constructor with the smallest possible number of arguments.static StringcreateString(char[] chars) Create a string from the specified array of characters.static Class<?>getNonArrayTypeFromSignature(String signature, ClassLoader cl) Lookup or load the non-array class based on the specified signature.static org.jppf.serialization.FieldDescriptor[]getPersistentDeclaredFields(Class<?> clazz) Get all declared non-transient and non-static fields of the given class.static StringgetSignatureFromType(Class<?> clazz) Get a unique string representation for the specified type.static char[]Get the chars in a string without copying the array.static Class<?>getTypeFromSignature(String signature, ClassLoader cl) Lookup or load the non-array class based on the specified signature.
-
Constructor Details
-
SerializationReflectionHelper
public SerializationReflectionHelper()
-
-
Method Details
-
getPersistentDeclaredFields
public static org.jppf.serialization.FieldDescriptor[] getPersistentDeclaredFields(Class<?> clazz) throws Exception Get all declared non-transient and non-static fields of the given class.- Parameters:
clazz- the class object from which to extract the fields.- Returns:
- an array of
FieldDescriptorobjects. - Throws:
Exception- if any error occurs.
-
getSignatureFromType
Get a unique string representation for the specified type.- Parameters:
clazz- the type from which to get the signature.- Returns:
- a string representing the type.
- Throws:
Exception- if any error occurs.
-
getTypeFromSignature
Lookup or load the non-array class based on the specified signature. -
getNonArrayTypeFromSignature
public static Class<?> getNonArrayTypeFromSignature(String signature, ClassLoader cl) throws Exception Lookup or load the non-array class based on the specified signature. -
create
Create an object without calling any of its class constructors if the JVM supports it, or failing that, attempt to call the constructor with the smallest possible number of arguments.- Parameters:
clazz- the object's class.- Returns:
- the newly created object.
- Throws:
Exception- if any error occurs.
-
createString
Create a string from the specified array of characters.- Parameters:
chars- the string's value.- Returns:
- a new string with the specified characters.
- Throws:
Exception- if any error occurs.
-
getStringValue
Get the chars in a string without copying the array.- Parameters:
s- the string to get the chars from.- Returns:
- an array of chars.
- Throws:
Exception- if any error occurs.
-