public class DefaultClassInstantiator extends java.lang.Object implements IClassInstantiator
Modifier and Type | Field and Description |
---|---|
private static java.lang.Class<?>[] |
EMPTY |
Constructor and Description |
---|
DefaultClassInstantiator() |
Modifier and Type | Method and Description |
---|---|
private static java.lang.Long |
callLongMethod(java.lang.Class<?> clazz,
java.lang.String methodName) |
java.lang.Object[] |
getArgsForTypes(java.lang.Class<?>[] methodTypes)
Get some default instances of provided classes
|
java.lang.reflect.Constructor<?> |
getConstructorToUse(java.lang.Class<?> clazz)
Return the constructor considered the best to use with this class.
|
private static java.lang.Long |
getSerializableUID(java.lang.Class<?> clazz) |
private static byte[] |
getSerializedBytes(java.lang.Class<?> clazz) |
private boolean |
isSerializable(java.lang.Class<?> clazz)
Tells if the provided class is serializable
|
java.lang.Object |
newInstance(java.lang.Class<?> c)
Try to instantiate a class without using a special constructor.
|
private static java.lang.Object |
readObject(byte[] bytes) |
public java.lang.Object newInstance(java.lang.Class<?> c) throws java.lang.InstantiationException
newInstance
in interface IClassInstantiator
c
- Class to instantiatejava.lang.InstantiationException
private boolean isSerializable(java.lang.Class<?> clazz)
clazz
- Class to checkpublic java.lang.reflect.Constructor<?> getConstructorToUse(java.lang.Class<?> clazz)
clazz
- Class in which constructor is searchedpublic java.lang.Object[] getArgsForTypes(java.lang.Class<?>[] methodTypes) throws java.lang.InstantiationException
methodTypes
- Classes to instantiatejava.lang.InstantiationException
- Thrown if the class instantiation failsprivate static byte[] getSerializedBytes(java.lang.Class<?> clazz) throws java.io.IOException
java.io.IOException
private static java.lang.Long getSerializableUID(java.lang.Class<?> clazz)
private static java.lang.Long callLongMethod(java.lang.Class<?> clazz, java.lang.String methodName)
private static java.lang.Object readObject(byte[] bytes) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException