本文整理汇总了Java中act.app.App.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java App.getInstance方法的具体用法?Java App.getInstance怎么用?Java App.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类act.app.App
的用法示例。
在下文中一共展示了App.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invoke
import act.app.App; //导入方法依赖的package包/类
@Override
public void invoke(Object... args) {
int paramNo = paramTypes.size();
int argsNo = args.length;
Object[] realArgs = args;
if (paramNo != argsNo || providedParamSize > 0) {
realArgs = new Object[paramNo + providedParamSize];
System.arraycopy(args, 0, realArgs, 0, Math.min(paramNo, argsNo));
App app = Act.app();
for (int i = 0; i < providedParamSize; ++i) {
realArgs[i + paramNo] = app.getInstance(providedParamTypes.get(i));
}
}
Object host = host();
if (null == host) {
$.invokeStatic(method, realArgs);
} else {
$.invokeVirtual(host, method, realArgs);
}
}
示例2: tryGetSingleton
import act.app.App; //导入方法依赖的package包/类
/**
* If the `invokerClass` specified is singleton, or without field or all fields are
* stateless, then return an instance of the invoker class. Otherwise, return null
* @param invokerClass the invoker class
* @param app the app
* @return an instance of the invokerClass or `null` if invoker class is stateful class
*/
public static Object tryGetSingleton(Class<?> invokerClass, App app) {
Object singleton = app.singleton(invokerClass);
if (null == singleton) {
// check if there are fields
List<Field> fields = $.fieldsOf(invokerClass);
if (fields.isEmpty()) {
singleton = app.getInstance(invokerClass);
}
boolean stateful = false;
for (Field field : fields) {
if (!isGlobalOrStateless(field)) {
stateful = true;
break;
}
}
if (!stateful) {
singleton = app.getInstance(invokerClass);
}
}
return singleton;
}
示例3: itShallNotCreateDefaultConstructorForNonSimpleBeanWithoutDefaultConstructor
import act.app.App; //导入方法依赖的package包/类
@GetAction("def_const/nsbean_no_def_const")
public void itShallNotCreateDefaultConstructorForNonSimpleBeanWithoutDefaultConstructor(App app) {
try {
app.getInstance(NotSimpleBeanWithoutDefaultConstructor.class);
throw new UnexpectedException();
} catch (InjectException e) {
// this is correct behavior ignore it
}
}
示例4: jobClassInstance
import act.app.App; //导入方法依赖的package包/类
private Object jobClassInstance(App app, JobContext ctx) {
if (isStatic) {
return null;
}
if (null != singleton) {
return singleton;
}
return null != paramValueLoaderService ?
paramValueLoaderService.loadHostBean(jobClass, ctx)
: app.getInstance(jobClass);
}
示例5: foundConfigurator
import act.app.App; //导入方法依赖的package包/类
@SubClassFinder(callOn = SysEventId.CLASS_LOADED)
public static void foundConfigurator(final Class<? extends AppConfigurator> configuratorClass) {
final App app = App.instance();
AppConfigurator configurator = app.getInstance(configuratorClass);
configurator.app(app);
configurator.configure();
app.config()._merge(configurator);
}
示例6: host
import act.app.App; //导入方法依赖的package包/类
private Object host() {
if (isStatic) {
return null;
} else {
if (null == host) {
synchronized (this) {
if (null == host) {
App app = App.instance();
host = app.getInstance(hostClass);
}
}
}
return host;
}
}
示例7: found
import act.app.App; //导入方法依赖的package包/类
@Override
protected void found(Class<? extends StringValueResolver> target, App app) {
if (target == Param.DEFAULT_RESOLVER.class) {
return;
}
if (target.isAnnotationPresent(NoAutoRegister.class)) {
return;
}
StringValueResolver resolver = app.getInstance(target);
app.resolverManager().register(resolver.targetType(), resolver);
}
示例8: foundProviderBase
import act.app.App; //导入方法依赖的package包/类
@SubClassFinder
public static void foundProviderBase(Class<? extends ActProvider> providerClass) {
App app = App.instance();
GenieInjector genieInjector = app.injector();
ActProvider provider = app.getInstance(providerClass);
genieInjector.genie().registerProvider(provider.targetType(), provider);
}
示例9: itShallCreateDefaultConstructorForSimpleBeanWithoutDefaultConstructor
import act.app.App; //导入方法依赖的package包/类
@GetAction("def_const/sbean_no_def_const")
public void itShallCreateDefaultConstructorForSimpleBeanWithoutDefaultConstructor(App app) {
app.getInstance(SimpleBeanWithoutDefaultConstructor.class);
}
示例10: itShallNotCreateDefaultConstructorForSimpleBeanWithDefaultConstructor
import act.app.App; //导入方法依赖的package包/类
@GetAction("def_const/sbean_def_const")
public void itShallNotCreateDefaultConstructorForSimpleBeanWithDefaultConstructor(App app) {
app.getInstance(SimpleBeanWithDefaultConstructor.class);
}
示例11: itShallNotCreateDefaultConstructorForNonSimpleBeanWithDefaultConstructor
import act.app.App; //导入方法依赖的package包/类
@GetAction("def_const/nsbean_def_const")
public void itShallNotCreateDefaultConstructorForNonSimpleBeanWithDefaultConstructor(App app) {
app.getInstance(NotSimpleBeanWithDefaultConstructor.class);
}
示例12: itShallCreateDefaultConstructorForDerivedSimpleBeanWithoutDefaultConstructor
import act.app.App; //导入方法依赖的package包/类
@GetAction("def_const/dsbean_no_def_const")
public void itShallCreateDefaultConstructorForDerivedSimpleBeanWithoutDefaultConstructor(App app) {
app.getInstance(DerivedSimpleBean.class);
}
示例13: itShallTreatClassAsSimpleBeanIfItImplementsInterfaceExtendsSimpleBean
import act.app.App; //导入方法依赖的package包/类
@GetAction("intf_extends_sbean")
public void itShallTreatClassAsSimpleBeanIfItImplementsInterfaceExtendsSimpleBean(App app) {
app.getInstance(SimpleModel.SomeModel.class);
}
示例14: before
import act.app.App; //导入方法依赖的package包/类
@Before
public void before(App app) {
app.getInstance(String.class);
}
示例15: someStupidLogic
import act.app.App; //导入方法依赖的package包/类
@Before
public void someStupidLogic(App app) {
String empty = app.getInstance(String.class);
}