com.sun.xml.bind.v2

Class ClassFactory

public final class ClassFactory extends Object

Creates new instances of classes.

This code handles the case where the class is not public or the constructor is not public.

Since: 2.0

Method Summary
static <T> Tcreate(Class<T> clazz)
The same as ClassFactory but with an error handling to make the instanciation error fatal.
static Objectcreate(Method method)
Call a method in the factory class to get the object.
static <T> Tcreate0(Class<T> clazz)
Creates a new instance of the class but throw exceptions without catching it.
static <T> Class<? extends T>inferImplClass(Class<T> fieldType, Class[] knownImplClasses)
Infers the instanciable implementation class that can be assigned to the given field type.

Method Detail

create

public static <T> T create(Class<T> clazz)
The same as ClassFactory but with an error handling to make the instanciation error fatal.

create

public static Object create(Method method)
Call a method in the factory class to get the object.

create0

public static <T> T create0(Class<T> clazz)
Creates a new instance of the class but throw exceptions without catching it.

inferImplClass

public static <T> Class<? extends T> inferImplClass(Class<T> fieldType, Class[] knownImplClasses)
Infers the instanciable implementation class that can be assigned to the given field type.

Returns: null if inference fails.