|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.opensymphony.xwork2.ObjectFactory
public class ObjectFactory
ObjectFactory is responsible for building the core framework objects. Users may register their own implementation of the ObjectFactory to control instantiation of these Objects.
This default implementation uses thebuildBean
method to create all classes (interceptors, actions, results, etc).
Field Summary | |
---|---|
protected ReflectionProvider |
reflectionProvider
|
Constructor Summary | |
---|---|
ObjectFactory()
|
|
ObjectFactory(ReflectionProvider prov)
|
Method Summary | |
---|---|
java.lang.Object |
buildAction(java.lang.String actionName,
java.lang.String namespace,
ActionConfig config,
java.util.Map<java.lang.String,java.lang.Object> extraContext)
Build an instance of the action class to handle a particular request (eg. |
java.lang.Object |
buildBean(java.lang.Class clazz,
java.util.Map<java.lang.String,java.lang.Object> extraContext)
Build a generic Java object of the given type. |
java.lang.Object |
buildBean(java.lang.String className,
java.util.Map<java.lang.String,java.lang.Object> extraContext)
Build a generic Java object of the given type. |
java.lang.Object |
buildBean(java.lang.String className,
java.util.Map<java.lang.String,java.lang.Object> extraContext,
boolean injectInternal)
Build a generic Java object of the given type. |
Interceptor |
buildInterceptor(InterceptorConfig interceptorConfig,
java.util.Map<java.lang.String,java.lang.String> interceptorRefParams)
Builds an Interceptor from the InterceptorConfig and the Map of parameters from the interceptor reference. |
Result |
buildResult(ResultConfig resultConfig,
java.util.Map<java.lang.String,java.lang.Object> extraContext)
Build a Result using the type in the ResultConfig and set the parameters in the ResultConfig. |
Validator |
buildValidator(java.lang.String className,
java.util.Map<java.lang.String,java.lang.String> params,
java.util.Map<java.lang.String,java.lang.Object> extraContext)
Build a Validator of the given type and set the parameters on it |
java.lang.Class |
getClassInstance(java.lang.String className)
Utility method to obtain the class matched to className. |
static ObjectFactory |
getObjectFactory()
Deprecated. Since 2.1 |
protected java.lang.Object |
injectInternalBeans(java.lang.Object obj)
|
boolean |
isNoArgConstructorRequired()
Allows for ObjectFactory implementations that support Actions without no-arg constructors. |
void |
setClassLoader(java.lang.ClassLoader cl)
|
void |
setContainer(Container container)
|
void |
setReflectionProvider(ReflectionProvider prov)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ReflectionProvider reflectionProvider
Constructor Detail |
---|
public ObjectFactory()
public ObjectFactory(ReflectionProvider prov)
Method Detail |
---|
public void setClassLoader(java.lang.ClassLoader cl)
public void setReflectionProvider(ReflectionProvider prov)
public void setContainer(Container container)
@Deprecated public static ObjectFactory getObjectFactory()
public boolean isNoArgConstructorRequired()
public java.lang.Class getClassInstance(java.lang.String className) throws java.lang.ClassNotFoundException
className
- The fully qualified name of the class to return
java.lang.ClassNotFoundException
public java.lang.Object buildAction(java.lang.String actionName, java.lang.String namespace, ActionConfig config, java.util.Map<java.lang.String,java.lang.Object> extraContext) throws java.lang.Exception
actionName
- the name the action configuration is set up with in the configurationnamespace
- the namespace the action is configured inconfig
- the action configuration found in the config for the actionName / namespaceextraContext
- a Map of extra context which uses the same keys as the ActionContext
java.lang.Exception
public java.lang.Object buildBean(java.lang.Class clazz, java.util.Map<java.lang.String,java.lang.Object> extraContext) throws java.lang.Exception
clazz
- the type of Object to buildextraContext
- a Map of extra context which uses the same keys as the ActionContext
java.lang.Exception
protected java.lang.Object injectInternalBeans(java.lang.Object obj)
obj
- public java.lang.Object buildBean(java.lang.String className, java.util.Map<java.lang.String,java.lang.Object> extraContext) throws java.lang.Exception
className
- the type of Object to buildextraContext
- a Map of extra context which uses the same keys as the ActionContext
java.lang.Exception
public java.lang.Object buildBean(java.lang.String className, java.util.Map<java.lang.String,java.lang.Object> extraContext, boolean injectInternal) throws java.lang.Exception
className
- the type of Object to buildextraContext
- a Map of extra context which uses the same keys as the ActionContext
java.lang.Exception
public Interceptor buildInterceptor(InterceptorConfig interceptorConfig, java.util.Map<java.lang.String,java.lang.String> interceptorRefParams) throws ConfigurationException
interceptorConfig
- the InterceptorConfig from the configurationinterceptorRefParams
- a Map of params provided in the Interceptor reference in the
Action mapping or InterceptorStack definition
ConfigurationException
public Result buildResult(ResultConfig resultConfig, java.util.Map<java.lang.String,java.lang.Object> extraContext) throws java.lang.Exception
resultConfig
- the ResultConfig found for the action with the result code returnedextraContext
- a Map of extra context which uses the same keys as the ActionContext
java.lang.Exception
public Validator buildValidator(java.lang.String className, java.util.Map<java.lang.String,java.lang.String> params, java.util.Map<java.lang.String,java.lang.Object> extraContext) throws java.lang.Exception
className
- the type of Validator to buildparams
- property name -> value Map to set onto the Validator instanceextraContext
- a Map of extra context which uses the same keys as the ActionContext
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |