public class ReflectiveCreator extends java.lang.Object implements Creator
Constructor and Description |
---|
ReflectiveCreator() |
Modifier and Type | Method and Description |
---|---|
<T> T |
create(java.lang.Class<T> clazz)
Create an object instance.
|
protected <T> java.lang.reflect.Constructor<T> |
getCachedConstructor(java.lang.Class<T> clazz)
Get a cached constructor for the class.
|
protected <T> java.lang.reflect.Constructor<T> |
getNewConstructor(java.lang.Class<T> clazz)
Get the constructor to use for a class.
|
protected <T> java.lang.reflect.Constructor<T> getNewConstructor(java.lang.Class<T> clazz)
null
if no suitable constructor is available.clazz
- the class to get a constructor fornull
if none is availableprotected <T> java.lang.reflect.Constructor<T> getCachedConstructor(java.lang.Class<T> clazz) throws java.io.InvalidClassException
getNewConstructor()
method is invoked to get it. If no constructor is available then an
InstantiationException
is thrown.clazz
- the class to look upjava.lang.InstantiationException
- if no suitable constructor is availablejava.io.InvalidClassException
public <T> T create(java.lang.Class<T> clazz) throws java.io.InvalidClassException
Copyright © 2011 JBoss, a division of Red Hat, Inc.