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


Java NoOp.INSTANCE属性代码示例

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


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

示例1: benchmarkCglib

/**
 * Performs a benchmark of an interface implementation using cglib.
 *
 * @return The created instance, in order to avoid JIT removal.
 */
@Benchmark
public ExampleInterface benchmarkCglib() {
    Enhancer enhancer = new Enhancer();
    enhancer.setUseCache(false);
    enhancer.setClassLoader(newClassLoader());
    enhancer.setSuperclass(baseClass);
    CallbackHelper callbackHelper = new CallbackHelper(Object.class, new Class[]{baseClass}) {
        @Override
        protected Object getCallback(Method method) {
            if (method.getDeclaringClass() == baseClass) {
                return new FixedValue() {
                    @Override
                    public Object loadObject() throws Exception {
                        return null;
                    }
                };
            } else {
                return NoOp.INSTANCE;
            }
        }
    };
    enhancer.setCallbackFilter(callbackHelper);
    enhancer.setCallbacks(callbackHelper.getCallbacks());
    return (ExampleInterface) enhancer.create();
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:30,代码来源:ClassByImplementationBenchmark.java

示例2: createServiceEndpoint

public Remote createServiceEndpoint() throws ServiceException {
        //TODO figure out why this can't be called in readResolve!
//        synchronized (this) {
//            if (!initialized) {
//                initialize();
//                initialized = true;
//            }
//        }
        Service service = ((ServiceImpl) serviceImpl).getService();
        GenericServiceEndpoint serviceEndpoint = new GenericServiceEndpoint(portQName, service, location);
        Callback callback = new ServiceEndpointMethodInterceptor(serviceEndpoint, sortedOperationInfos, credentialsName);
        Callback[] callbacks = new Callback[]{NoOp.INSTANCE, callback};
        Enhancer.registerCallbacks(serviceEndpointClass, callbacks);
        try {
            return (Remote) constructor.newInstance(new Object[]{serviceEndpoint});
        } catch (InvocationTargetException e) {
            throw (ServiceException) new ServiceException("Could not construct service instance", e.getTargetException()).initCause(e);
        }
    }
 
开发者ID:apache,项目名称:tomee,代码行数:19,代码来源:SeiFactoryImpl.java

示例3: ComponentInstantiationPostProcessor

public ComponentInstantiationPostProcessor() {
    _callbacks = new Callback[2];
    _callbacks[0] = NoOp.INSTANCE;
    _callbacks[1] = new InterceptorDispatcher();

    _callbackFilter = new InterceptorFilter();
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:7,代码来源:ComponentInstantiationPostProcessor.java

示例4: create

@SuppressWarnings("unchecked")
public static <T> T create(Class<T> targetClass) throws InstantiationException, IllegalAccessException {
	Enhancer enhancer = new Enhancer();
	enhancer.setSuperclass(targetClass);
	enhancer.setClassLoader(targetClass.getClassLoader());
	enhancer.setCallbackFilter(new TransactionalCallbackFilter());
	Callback[] callbacks = new Callback[]{new DalTransactionInterceptor(), NoOp.INSTANCE};
	enhancer.setCallbacks(callbacks);
	enhancer.setInterfaces(new Class[]{TransactionalIntercepted.class});
	return (T)enhancer.create();
}
 
开发者ID:ctripcorp,项目名称:dal,代码行数:11,代码来源:DalTransactionManager.java

示例5: getCallback

@Override
protected Object getCallback(Method method) {
    if(method.getName().equals("name") && method.getReturnType().equals(String.class)) {
        return getNameCallback();
    }
    if (method.getName().equals("getRealClassName") && method.getReturnType().equals(String.class)) {
        return getRealClassName();
    }
    return NoOp.INSTANCE;
}
 
开发者ID:flipkart-incubator,项目名称:flux,代码行数:10,代码来源:ProxyEventCallbackFilter.java


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