本文整理汇总了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();
}
示例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);
}
}
示例3: ComponentInstantiationPostProcessor
public ComponentInstantiationPostProcessor() {
_callbacks = new Callback[2];
_callbacks[0] = NoOp.INSTANCE;
_callbacks[1] = new InterceptorDispatcher();
_callbackFilter = new InterceptorFilter();
}
示例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();
}
示例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;
}