本文整理了Java中net.sf.cglib.proxy.Factory.getCallback()
方法的一些代码示例,展示了Factory.getCallback()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Factory.getCallback()
方法的具体详情如下:
包路径:net.sf.cglib.proxy.Factory
类名称:Factory
方法名:getCallback
[英]Return the Callback
implementation at the specified index.
[中]返回指定索引处的Callback
实现。
代码示例来源:origin: apache/cloudstack
@DB()
public static <T> UpdateBuilder getUpdateBuilder(final T entityObject) {
final Factory factory = (Factory)entityObject;
assert (factory != null);
return (UpdateBuilder)factory.getCallback(1);
}
代码示例来源:origin: org.apache.commons/commons-pool2
@Override
public T resolveProxy(final T proxy) {
@SuppressWarnings("unchecked")
final
CglibProxyHandler<T> cglibProxyHandler =
(CglibProxyHandler<T>) ((Factory) proxy).getCallback(0);
final T pooledObject = cglibProxyHandler.disableProxy();
return pooledObject;
}
代码示例来源:origin: de.alpharogroup/model-type-safe
@Override
public Callback getCallback(Object proxy)
{
if (proxy instanceof Factory)
{
MethodInterceptorImplementation interceptor = (MethodInterceptorImplementation)((Factory)proxy)
.getCallback(0);
return interceptor.callback;
}
return null;
}
代码示例来源:origin: com.springsource.insight/insight-repo
/**
* Get the internal interceptor which contains the cache for a given
* proxied object.
*/
@SuppressWarnings("unchecked")
public CachingInterceptor<T> getCallback(T obj) {
if (obj instanceof Factory == false) {
return null;
}
return (CachingInterceptor<T>) (((Factory) obj).getCallback(0));
}
代码示例来源:origin: org.chromattic/chromattic.cglib
public MethodHandler getInvoker(Object proxy) {
if (proxy instanceof Factory) {
Factory factory = (Factory)proxy;
Callback callback = factory.getCallback(0);
if (callback instanceof MethodInterceptorInvoker) {
return ((MethodInterceptorInvoker)callback).invoker;
}
}
return null;
}
代码示例来源:origin: com.bbossgroups/bboss-persistent
@Override
public T resolveProxy(T proxy) {
@SuppressWarnings("unchecked")
CglibProxyHandler<T> cglibProxyHandler =
(CglibProxyHandler<T>) ((Factory) proxy).getCallback(0);
T pooledObject = cglibProxyHandler.disableProxy();
return pooledObject;
}
}
代码示例来源:origin: MissionCriticalCloud/cosmic
@DB()
public static <T> UpdateBuilder getUpdateBuilder(final T entityObject) {
final Factory factory = (Factory) entityObject;
assert (factory != null);
return (UpdateBuilder) factory.getCallback(1);
}
代码示例来源:origin: org.apache.directory.api/api-ldap-client-all
@Override
public T resolveProxy(final T proxy) {
@SuppressWarnings("unchecked")
final
CglibProxyHandler<T> cglibProxyHandler =
(CglibProxyHandler<T>) ((Factory) proxy).getCallback(0);
final T pooledObject = cglibProxyHandler.disableProxy();
return pooledObject;
}
代码示例来源:origin: appoxy/simplejpa
public static <T> void replaceEntityManager(T newInstance, EntityManagerSimpleJPA em) {
if (newInstance instanceof Factory) {
Factory factory = (Factory) newInstance;
LazyInterceptor interceptor = (LazyInterceptor) factory.getCallback(0);
interceptor.setEntityManager(em);
}
}
代码示例来源:origin: springframework/spring-aop
public Object intercept(Object proxy, Method method, Object[] args,
MethodProxy methodProxy) throws Throwable {
Object other = args[0];
if (other == null) {
return Boolean.FALSE;
}
if (other == proxy) {
return Boolean.TRUE;
}
AdvisedSupport otherAdvised = null;
if (other instanceof Factory) {
Callback callback = ((Factory) other).getCallback(INVOKE_EQUALS);
if (!(callback instanceof EqualsInterceptor)) {
return Boolean.FALSE;
}
otherAdvised = ((EqualsInterceptor) callback).advised;
}
else {
// not a valid comparison
return Boolean.FALSE;
}
return new Boolean(AopProxyUtils.equalsInProxy(this.advised, otherAdvised));
}
}
代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all
return args[0] instanceof Factory && ( ( Factory ) args[0] ).getCallback( 0 ) == this
? Boolean.TRUE
: Boolean.FALSE;
代码示例来源:origin: org.apache.commons/commons-digester3
void finalize( Object proxy )
throws Exception
{
digester.popParams();
( (DeferredConstructionCallback) ( (Factory) proxy ).getCallback( 0 ) ).establishDelegate();
}
}
代码示例来源:origin: com.github.javaclub/jorm
return args[0] instanceof Factory && ( ( Factory ) args[0] ).getCallback( 0 ) == this
? Boolean.TRUE
: Boolean.FALSE;
代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service
String injectionSource = null;
if (Factory.class.isInstance(component)) {
overwrites = ((OverwriteProxy) ((Factory) component).getCallback(0)).getOverwrites();
injectionSource = ((OverwriteProxy) ((Factory) component).getCallback(0)).getInjectionSource();
realClass = realClass.getSuperclass();
代码示例来源:origin: EaseTech/easytest-core
if (fieldInstance instanceof Factory) {
Factory cglibFactory = (Factory) fieldInstance;
InternalInterceptor internalInterceptor = (InternalInterceptor) cglibFactory.getCallback(0);
targetInstance = internalInterceptor.getTargetInstance();
} else {
代码示例来源:origin: org.ops4j.pax.wicket/org.ops4j.pax.wicket.service
String injectionSource = PaxWicketBeanInjectionSource.INJECTION_SOURCE_SCAN;
if (Factory.class.isInstance(component)) {
overwrites = ((OverwriteProxy) ((Factory) component).getCallback(0)).getOverwrites();
injectionSource = ((OverwriteProxy) ((Factory) component).getCallback(0)).getInjectionSource();
realClass = realClass.getSuperclass();
} else {
代码示例来源:origin: org.mapdb/thread-weaver
/**
* Creates a new instance of the given class, using the supplied interceptor.
* Uses the EasyMock ClassInstantiatorFactory in order to avoid the cglib
* limitation that prevents us from creating instances of classes that do not
* have public default constructors.
*/
private Object create(Class<?> clss, Interceptor interceptor) {
Enhancer e = new Enhancer();
e.setSuperclass(clss);
e.setCallbackType(interceptor.getClass());
Class<?> controlClass = e.createClass();
Enhancer.registerCallbacks(controlClass, new Callback[] { interceptor });
Factory result = (Factory) objenesis.newInstance(controlClass);
// This call is required to work around a cglib feature. See the comment in
// org.easymock.classextension.internal.ClassProxyFactory, which uses the
// same approach.
result.getCallback(0);
// And this call is required to work around a memory leak in cglib, which
// sticks references to the class in a ThreadLocal that is never cleared.
// See http://opensource.atlassian.com/projects/hibernate/browse/HHH-2481
Enhancer.registerCallbacks(controlClass, null);
return result;
}
代码示例来源:origin: ops4j/org.ops4j.pax.wicket
String injectionSource = PaxWicketBeanInjectionSource.INJECTION_SOURCE_SCAN;
if (Factory.class.isInstance(component)) {
overwrites = ((OverwriteProxy) ((Factory) component).getCallback(0)).getOverwrites();
injectionSource = ((OverwriteProxy) ((Factory) component).getCallback(0)).getInjectionSource();
realClass = realClass.getSuperclass();
} else {
代码示例来源:origin: liukaixuan/guzz
return descriptor.getDomainClass().getName() + "@" + System.identityHashCode(obj);
}else if("equals".equals(name)){
return args[0] instanceof Factory && ( ( Factory ) args[0] ).getCallback( 0 ) == this
? Boolean.TRUE
: Boolean.FALSE;
代码示例来源:origin: intermine/intermine
public void testParseDynamic() throws Exception {
String s = NotXmlParser.DELIM + "org.intermine.model.testmodel.Company net.sf.cglib.proxy.Factory"
+ NotXmlParser.DELIM + "raddress" + NotXmlParser.DELIM + "74328"
+ NotXmlParser.DELIM + "avatNumber" + NotXmlParser.DELIM + "100"
+ NotXmlParser.DELIM + "aname" + NotXmlParser.DELIM + "CompanyC"
+ NotXmlParser.DELIM + "aid" + NotXmlParser.DELIM + "74350";
Company obj1 = (Company) NotXmlParser.parse(s, os);
assertEquals("CompanyC", obj1.getName());
assertEquals(100, obj1.getVatNumber());
assertEquals(new Integer(74350), obj1.getId());
Map fieldMap = ((DynamicBean) ((net.sf.cglib.proxy.Factory) obj1).getCallback(0)).getMap();
ProxyReference addressRef = (ProxyReference) fieldMap.get("address");
assertNotNull(addressRef);
assertEquals(new Integer(74328), addressRef.getId());
}
内容来源于网络,如有侵权,请联系作者删除!