|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.morph.reflect.reflectors.BaseReflector net.sf.morph.reflect.reflectors.SimpleInstantiatingReflector
public class SimpleInstantiatingReflector
A basic instantiating reflector that allows an arbitrary number of requested
class types to be mapped to instantiated types. The default instance of this
class can instantiate common interfaces such as Calendar
and CharSequence
.
Field Summary |
---|
Fields inherited from class net.sf.morph.reflect.reflectors.BaseReflector |
---|
log |
Constructor Summary | |
---|---|
SimpleInstantiatingReflector()
Create a new SimpleInstantiatingReflector. |
|
SimpleInstantiatingReflector(java.lang.Class instantiatedType)
Create a new SimpleInstantiatingReflector for a single type. |
|
SimpleInstantiatingReflector(java.lang.Class requestedType,
java.lang.Class instantiatedType)
Create a new SimpleInstantiatingReflector for a single type mapping. |
|
SimpleInstantiatingReflector(java.util.Map requestedToInstantiatedClassMap)
Create a new SimpleInstantiatingReflector for the specified type map. |
Method Summary | |
---|---|
java.lang.Class |
getInstantiatedType()
Returns the instantiated type if only a single mapping of requested type to instantiated type has been specified. |
protected java.lang.Class[] |
getReflectableClassesImpl()
Implementation of Reflector.getReflectableClasses() . |
java.util.Map |
getRequestedToInstantiatedTypeMap()
Returns the mapping of requested types to instantiated types. |
java.lang.Class |
getRequestedType()
Returns the requested type if only a single mapping of requested type to instantiated type has been specified. |
protected java.lang.Object |
newInstanceImpl(java.lang.Class requestedType,
java.lang.Object parameters)
Implementation of InstantiatingReflector.newInstance(Class, Object) . |
void |
setInstantiatedType(java.lang.Class instantiatedType)
Sets the instantiated type if only a single mapping of requested type to instantiated type is needed. |
void |
setRequestedToInstantiatedTypeMap(java.util.Map interfaceToImplementationMap)
Sets the mapping of requested types to instantiated types. |
void |
setRequestedType(java.lang.Class requestedType)
Sets the requested type if only a single mapping of requested type to instantiated type is needed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.sf.morph.reflect.InstantiatingReflector |
---|
newInstance |
Methods inherited from interface net.sf.morph.reflect.Reflector |
---|
getReflectableClasses, getWrapper |
Constructor Detail |
---|
public SimpleInstantiatingReflector()
public SimpleInstantiatingReflector(java.lang.Class instantiatedType)
instantiatedType
- public SimpleInstantiatingReflector(java.lang.Class requestedType, java.lang.Class instantiatedType)
requestedType
- instantiatedType
- public SimpleInstantiatingReflector(java.util.Map requestedToInstantiatedClassMap)
requestedToInstantiatedClassMap
- Method Detail |
---|
protected java.lang.Class[] getReflectableClassesImpl() throws java.lang.Exception
Reflector.getReflectableClasses()
.
getReflectableClassesImpl
in class BaseReflector
java.lang.Exception
BaseReflector.getReflectableClassesImpl()
protected java.lang.Object newInstanceImpl(java.lang.Class requestedType, java.lang.Object parameters) throws java.lang.Exception
InstantiatingReflector.newInstance(Class, Object)
.
Default implementation returns a new instance of the given class by
calling Class#newInstance())
.
newInstanceImpl
in class BaseReflector
java.lang.Exception
BaseReflector.newInstanceImpl(java.lang.Class, java.lang.Object)
public final java.lang.Class getInstantiatedType()
null
if no instantiated type has been specified
java.lang.IllegalStateException
- if there is more than one mapping of requested type to
instantiated typepublic final void setInstantiatedType(java.lang.Class instantiatedType)
instantiatedType
- the instantiated typepublic final java.lang.Class getRequestedType()
null
if no requested type has been specified
java.lang.IllegalStateException
- if there is more than one mapping of requested type to
instantiated typepublic final void setRequestedType(java.lang.Class requestedType)
requestedType
- the requested typepublic java.util.Map getRequestedToInstantiatedTypeMap()
public void setRequestedToInstantiatedTypeMap(java.util.Map interfaceToImplementationMap)
interfaceToImplementationMap
- the mapping of requested types to instantiated types
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |