| Method from com.google.inject.struts2.GuiceObjectFactory Detail: |
public Object buildBean(Class clazz,
Map extraContext) {
if (injector == null) {
synchronized (this) {
if (injector == null) {
createInjector();
}
}
}
return injector.getInstance(clazz);
}
|
public Interceptor buildInterceptor(InterceptorConfig interceptorConfig,
Map interceptorRefParams) throws ConfigurationException {
// Ensure the interceptor class is present.
Class< ? extends Interceptor > interceptorClass;
try {
interceptorClass = getClassInstance(interceptorConfig.getClassName());
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
ProvidedInterceptor providedInterceptor = new ProvidedInterceptor(
interceptorConfig, interceptorRefParams, interceptorClass);
interceptors.add(providedInterceptor);
return providedInterceptor;
}
|
public Class getClassInstance(String name) throws ClassNotFoundException {
Class< ? > clazz = super.getClassInstance(name);
synchronized (this) {
if (injector == null) {
// We can only bind each class once.
if (!boundClasses.contains(clazz)) {
try {
// Calling these methods now helps us detect ClassNotFoundErrors
// early.
clazz.getDeclaredFields();
clazz.getDeclaredMethods();
boundClasses.add(clazz);
} catch (Throwable t) {
// Struts should still work even though some classes aren't in the
// classpath. It appears we always get the exception here when
// this is the case.
return clazz;
}
}
}
}
return clazz;
}
|
public boolean isNoArgConstructorRequired() {
return false;
}
|
void setDevelopmentMode(String developmentMode) {
this.developmentMode = developmentMode.trim().equals("true");
}
|
void setModule(String moduleClassName) {
try {
// Instantiate user's module.
@SuppressWarnings({"unchecked"})
Class< ? extends Module > moduleClass =
(Class< ? extends Module >) Class.forName(moduleClassName);
this.module = moduleClass.newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
|
Interceptor superBuildInterceptor(InterceptorConfig interceptorConfig,
Map interceptorRefParams) throws ConfigurationException {
return super.buildInterceptor(interceptorConfig, interceptorRefParams);
}
|