|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.spicefactory.lib.reflect.ReflectionFactory
public class ReflectionFactory
The ReflectionFactory is the central factory for the Spicelib reflection package. It creates and caches instances of Bean, MethodInvoker and TypeContext in a thread-safe way. It is also a central repository for Converter instances which will be used within all types of objects created by this factory. It uses builtin Converters for Numbers, Arrays and Collections. You can register additional Converter types if required.
| Constructor Summary | |
|---|---|
ReflectionFactory()
Creates a new ReflectionFactory. |
|
| Method Summary | |
|---|---|
void |
addConverter(Converter<?> converter)
Adds the given Converter instance to the repository. |
Bean |
getBean(Class<?> type)
Returns the Bean instance representing the given Class. |
Converter<?> |
getConverter(Class<?> type)
Returns the Converter instance that is applicable to the given target type. |
Set<Converter<?>> |
getConverters()
Returns all Converter instances registered with this factory including the builtin ones. |
MethodInvoker |
getMethodInvoker(Method method,
Class<?> contextClass)
Returns a MethodInvoker instance for the given Method and context Class. |
TypeContext |
getTypeContext(Type contextType,
Class<?> baseType)
Returns a TypeContext for the given context and base types. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReflectionFactory()
| Method Detail |
|---|
public void addConverter(Converter<?> converter)
MyConverter implements Converter<File>
or MyConverter<T extends File> implements Converter<T> is permitted while
MyConverter<T> implements Converter<T> is not since the target type this Converter
can be applied to cannot be determined with an unbounded TypeVariable.
converter - the Converter instance to be added to the repositorypublic Converter<?> getConverter(Class<?> type)
getConverter(Integer.class)
type - the class that the returned Converter instance should be applicable to
public Set<Converter<?>> getConverters()
public Bean getBean(Class<?> type)
type - the class a Bean representation should be created for
public MethodInvoker getMethodInvoker(Method method,
Class<?> contextClass)
method - the Method an invoker should be created forcontextClass - the context Class for the MethodInvoker
public TypeContext getTypeContext(Type contextType,
Class<?> baseType)
contextType - the context typebaseType - the base type
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||