当前位置: 首页>>代码示例>>Java>>正文


Java App.getInstance方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:actframework,项目名称:actframework,代码行数:21,代码来源:ReflectedSimpleEventListener.java

示例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;
}
 
开发者ID:actframework,项目名称:actframework,代码行数:29,代码来源:ReflectedInvokerHelper.java

示例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
    }
}
 
开发者ID:actframework,项目名称:actframework,代码行数:10,代码来源:SimpleBeanTestBed.java

示例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);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:12,代码来源:ReflectedJobInvoker.java

示例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);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:9,代码来源:AppConfigPlugin.java

示例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;
    }
}
 
开发者ID:actframework,项目名称:actframework,代码行数:16,代码来源:ReflectedSimpleEventListener.java

示例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);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:12,代码来源:StringValueResolverFinder.java

示例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);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:8,代码来源:GenieInjector.java

示例9: itShallCreateDefaultConstructorForSimpleBeanWithoutDefaultConstructor

import act.app.App; //导入方法依赖的package包/类
@GetAction("def_const/sbean_no_def_const")
public void itShallCreateDefaultConstructorForSimpleBeanWithoutDefaultConstructor(App app) {
    app.getInstance(SimpleBeanWithoutDefaultConstructor.class);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:5,代码来源:SimpleBeanTestBed.java

示例10: itShallNotCreateDefaultConstructorForSimpleBeanWithDefaultConstructor

import act.app.App; //导入方法依赖的package包/类
@GetAction("def_const/sbean_def_const")
public void itShallNotCreateDefaultConstructorForSimpleBeanWithDefaultConstructor(App app) {
    app.getInstance(SimpleBeanWithDefaultConstructor.class);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:5,代码来源:SimpleBeanTestBed.java

示例11: itShallNotCreateDefaultConstructorForNonSimpleBeanWithDefaultConstructor

import act.app.App; //导入方法依赖的package包/类
@GetAction("def_const/nsbean_def_const")
public void itShallNotCreateDefaultConstructorForNonSimpleBeanWithDefaultConstructor(App app) {
    app.getInstance(NotSimpleBeanWithDefaultConstructor.class);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:5,代码来源:SimpleBeanTestBed.java

示例12: itShallCreateDefaultConstructorForDerivedSimpleBeanWithoutDefaultConstructor

import act.app.App; //导入方法依赖的package包/类
@GetAction("def_const/dsbean_no_def_const")
public void itShallCreateDefaultConstructorForDerivedSimpleBeanWithoutDefaultConstructor(App app) {
    app.getInstance(DerivedSimpleBean.class);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:5,代码来源:SimpleBeanTestBed.java

示例13: itShallTreatClassAsSimpleBeanIfItImplementsInterfaceExtendsSimpleBean

import act.app.App; //导入方法依赖的package包/类
@GetAction("intf_extends_sbean")
public void itShallTreatClassAsSimpleBeanIfItImplementsInterfaceExtendsSimpleBean(App app) {
    app.getInstance(SimpleModel.SomeModel.class);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:5,代码来源:SimpleBeanTestBed.java

示例14: before

import act.app.App; //导入方法依赖的package包/类
@Before
public void before(App app) {
    app.getInstance(String.class);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:5,代码来源:GH446.java

示例15: someStupidLogic

import act.app.App; //导入方法依赖的package包/类
@Before
public void someStupidLogic(App app) {
    String empty = app.getInstance(String.class);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:5,代码来源:GH449.java


注:本文中的act.app.App.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。