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


Java Factory.setCallback方法代码示例

本文整理汇总了Java中net.sf.cglib.proxy.Factory.setCallback方法的典型用法代码示例。如果您正苦于以下问题:Java Factory.setCallback方法的具体用法?Java Factory.setCallback怎么用?Java Factory.setCallback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.cglib.proxy.Factory的用法示例。


在下文中一共展示了Factory.setCallback方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import net.sf.cglib.proxy.Factory; //导入方法依赖的package包/类
/**
 * Creates the scoped proxy object using the given provider.
 *
 * @param injector The injector.
 * @return The scoped proxy object.
 */
@SuppressWarnings("unchecked")
public T create(Injector injector) {
    Preconditions.checkNotNull(injector, "injector");
    Preconditions.checkState(this.dispatcher != null, "no provider set");

    this.enhancer.setCallbackType(this.dispatcher.getClass());
    final Class<T> enhancedClass = this.enhancer.createClass();
    final Errors errors = new Errors();
    final T proxyInstance = this.constructionStrategy
            .createInstance(enhancedClass, injector, errors);

    errors.throwProvisionExceptionIfErrorsExist();
    final Factory factory = (Factory) proxyInstance;
    factory.setCallback(CALLBACK_INDEX, this.dispatcher);
    return proxyInstance;
}
 
开发者ID:skuzzle,项目名称:guice-scoped-proxy-extension,代码行数:23,代码来源:InstanceBuilder.java

示例2: decorateInstance

import net.sf.cglib.proxy.Factory; //导入方法依赖的package包/类
@Override
protected void decorateInstance(T result, final MethodIntercept methodIntercept) {
    MethodInterceptor methodInterceptor = new MethodInterceptor() {
        public Object intercept(final Object proxy, Method method, Object[] args, final MethodProxy superProxy) throws Throwable {
            return methodIntercept.intercept(proxy, new MethodAdapter(method), args, new MethodIntercept.SuperInvoker() {
                public Object invokeSuper(Object[] superArgs) throws Throwable {
                    return superProxy.invokeSuper(proxy, superArgs);
                }
            });
        }
    };
    Factory factory = (Factory) result;
    int callbackCount = factory.getCallbacks().length;
    for(int i = 0; i < callbackCount; i++) {
        factory.setCallback(i, methodInterceptor);
    }
}
 
开发者ID:pobrelkey,项目名称:moxiemocks,代码行数:18,代码来源:CGLIBProxyFactory.java

示例3: createSearchEntity

import net.sf.cglib.proxy.Factory; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public T createSearchEntity(MethodInterceptor interceptor) {
    T entity = (T)_searchEnhancer.create();
    final Factory factory = (Factory)entity;
    factory.setCallback(0, interceptor);
    return entity;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:8,代码来源:GenericDaoBase.java

示例4: createSearchEntity

import net.sf.cglib.proxy.Factory; //导入方法依赖的package包/类
public T createSearchEntity(final MethodInterceptor interceptor) {
    final T entity = (T) _searchEnhancer.create();
    final Factory factory = (Factory) entity;
    factory.setCallback(0, interceptor);
    return entity;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:7,代码来源:GenericDaoBase.java


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