本文整理汇总了Java中net.sf.cglib.proxy.AdvancedProxy类的典型用法代码示例。如果您正苦于以下问题:Java AdvancedProxy类的具体用法?Java AdvancedProxy怎么用?Java AdvancedProxy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AdvancedProxy类属于net.sf.cglib.proxy包,在下文中一共展示了AdvancedProxy类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDomInvocationHandler
import net.sf.cglib.proxy.AdvancedProxy; //导入依赖的package包/类
@Nullable
public static DomInvocationHandler getDomInvocationHandler(DomElement proxy) {
if (proxy instanceof DomFileElement) {
return null;
}
if (proxy instanceof DomInvocationHandler) {
return (DomInvocationHandler)proxy;
}
final InvocationHandler handler = AdvancedProxy.getInvocationHandler(proxy);
if (handler instanceof StableInvocationHandler) {
//noinspection unchecked
final DomElement element = ((StableInvocationHandler<DomElement>)handler).getWrappedElement();
return element == null ? null : getDomInvocationHandler(element);
}
if (handler instanceof DomInvocationHandler) {
return (DomInvocationHandler)handler;
}
return null;
}
示例2: getDomInvocationHandler
import net.sf.cglib.proxy.AdvancedProxy; //导入依赖的package包/类
@Nullable
public static DomInvocationHandler getDomInvocationHandler(DomElement proxy) {
if (proxy instanceof DomFileElement) {
return null;
}
if (proxy instanceof DomInvocationHandler) {
return (DomInvocationHandler)proxy;
}
final InvocationHandler handler = AdvancedProxy.getInvocationHandler(proxy);
if (handler instanceof StableInvocationHandler) {
final DomElement element = ((StableInvocationHandler<DomElement>)handler).getWrappedElement();
return element == null ? null : getDomInvocationHandler(element);
}
if (handler instanceof DomInvocationHandler) {
return (DomInvocationHandler)handler;
}
return null;
}
示例3: getDomInvocationHandler
import net.sf.cglib.proxy.AdvancedProxy; //导入依赖的package包/类
@Nullable
public static DomInvocationHandler getDomInvocationHandler(DomElement proxy)
{
if(proxy instanceof DomFileElement)
{
return null;
}
if(proxy instanceof DomInvocationHandler)
{
return (DomInvocationHandler) proxy;
}
final InvocationHandler handler = AdvancedProxy.getInvocationHandler(proxy);
if(handler instanceof StableInvocationHandler)
{
//noinspection unchecked
final DomElement element = ((StableInvocationHandler<DomElement>) handler).getWrappedElement();
return element == null ? null : getDomInvocationHandler(element);
}
if(handler instanceof DomInvocationHandler)
{
return (DomInvocationHandler) handler;
}
return null;
}
示例4: _mergeModels
import net.sf.cglib.proxy.AdvancedProxy; //导入依赖的package包/类
private <T> T _mergeModels(final Class<? super T> aClass, final MergingInvocationHandler<T> handler, final T... implementations) {
final Set<Class> commonClasses = getCommonClasses(new THashSet<Class>(), implementations);
commonClasses.add(MERGED_OBJECT_CLASS);
commonClasses.add(aClass);
final T t = AdvancedProxy.<T>createProxy(handler, null, commonClasses.toArray(new Class[commonClasses.size()]));
return t;
}
示例5: getProxy
import net.sf.cglib.proxy.AdvancedProxy; //导入依赖的package包/类
@NotNull
public final DomElement getProxy() {
DomElement proxy = myProxy;
if (proxy == null) {
Class<?> rawType = getRawType();
Class<? extends DomElement> implementation = myManager.getApplicationComponent().getImplementation(rawType);
final boolean isInterface = rawType.isInterface();
if (implementation == null && !isInterface) {
//noinspection unchecked
implementation = (Class<? extends DomElement>)rawType;
}
myProxy = proxy = AdvancedProxy.createProxy(this, implementation, isInterface ? new Class[]{rawType} : ArrayUtil.EMPTY_CLASS_ARRAY);
}
return proxy;
}
示例6: testExtendClass
import net.sf.cglib.proxy.AdvancedProxy; //导入依赖的package包/类
public void testExtendClass() throws Throwable {
final List<String> invocations = new ArrayList<String>();
Implementation implementation = AdvancedProxy.createProxy(Implementation.class, new Class[]{Interface3.class}, new InvocationHandler(){
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
invocations.add(method.getName());
if (Object.class.equals(method.getDeclaringClass())) {
return method.invoke(this, args);
}
return Implementation.class.getMethod("getField").invoke(proxy);
}
}, "239");
implementation.hashCode();
implementation.method();
assertEquals("239", implementation.getFoo());
implementation.setField("42");
assertEquals("42", implementation.getBar());
assertEquals("42", implementation.toString());
assertEquals(Arrays.asList("hashCode", "getFoo", "getFoo", "getBar"), invocations);
assertEquals("42", Interface1.class.getMethod("getFoo").invoke(implementation));
assertEquals("42", Interface3.class.getMethod("bar").invoke(implementation));
assertEquals("42", Interface1.class.getMethod("foo").invoke(implementation));
assertEquals("42", Interface2.class.getMethod("foo").invoke(implementation));
assertEquals("42", Interface2.class.getMethod("foo").invoke(implementation));
assertEquals("42", Implementation.class.getMethod("foo").invoke(implementation));
}
示例7: _mergeModels
import net.sf.cglib.proxy.AdvancedProxy; //导入依赖的package包/类
private <T> T _mergeModels(final Class<? super T> aClass, final MergingInvocationHandler<T> handler, final T... implementations) {
final Set<Class> commonClasses = getCommonClasses(new THashSet<Class>(), implementations);
commonClasses.add(MERGED_OBJECT_CLASS);
commonClasses.add(aClass);
final T t = AdvancedProxy.<T>createProxy(handler, null, commonClasses.toArray(new Class[commonClasses.size()]));
//myMergedMap.get(aClass).put(implementations, t);
return t;
}
示例8: DomInvocationHandler
import net.sf.cglib.proxy.AdvancedProxy; //导入依赖的package包/类
protected DomInvocationHandler(Type type, DomParentStrategy parentStrategy,
@NotNull final EvaluatedXmlName tagName,
final T childDescription,
final DomManagerImpl manager,
boolean dynamic,
@Nullable Stub stub) {
myManager = manager;
myParentStrategy = parentStrategy;
myTagName = tagName;
myChildDescription = childDescription;
myStub = stub;
myLastModCount = manager.getPsiModificationCount();
myType = narrowType(type);
final Class<?> rawType = getRawType();
myInvocationCache = manager.getApplicationComponent().getInvocationCache(rawType);
Class<? extends DomElement> implementation = manager.getApplicationComponent().getImplementation(rawType);
final boolean isInterface = ReflectionCache.isInterface(rawType);
if (implementation == null && !isInterface) {
implementation = (Class<? extends DomElement>)rawType;
}
myProxy = AdvancedProxy.createProxy(this, implementation, isInterface ? new Class[]{rawType} : ArrayUtil.EMPTY_CLASS_ARRAY);
refreshGenericInfo(dynamic);
if (stub != null) {
stub.setHandler(this);
}
}
示例9: DomInvocationHandler
import net.sf.cglib.proxy.AdvancedProxy; //导入依赖的package包/类
protected DomInvocationHandler(Type type, DomParentStrategy parentStrategy,
@NotNull final EvaluatedXmlName tagName,
final T childDescription,
final DomManagerImpl manager,
boolean dynamic,
@Nullable Stub stub) {
myManager = manager;
myParentStrategy = parentStrategy;
myTagName = tagName;
myChildDescription = childDescription;
myStub = stub;
myLastModCount = manager.getPsiModificationCount();
myType = narrowType(type);
final Class<?> rawType = getRawType();
myInvocationCache = manager.getApplicationComponent().getInvocationCache(rawType);
Class<? extends DomElement> implementation = manager.getApplicationComponent().getImplementation(rawType);
final boolean isInterface = rawType.isInterface();
if (implementation == null && !isInterface) {
implementation = (Class<? extends DomElement>)rawType;
}
myProxy = AdvancedProxy.createProxy(this, implementation, isInterface ? new Class[]{rawType} : ArrayUtil.EMPTY_CLASS_ARRAY);
refreshGenericInfo(dynamic);
if (stub != null) {
stub.setHandler(this);
}
}
示例10: getStableInvocationHandler
import net.sf.cglib.proxy.AdvancedProxy; //导入依赖的package包/类
public static StableInvocationHandler getStableInvocationHandler(Object proxy) {
return (StableInvocationHandler)AdvancedProxy.getInvocationHandler(proxy);
}
示例11: testAddInterfaces
import net.sf.cglib.proxy.AdvancedProxy; //导入依赖的package包/类
public void testAddInterfaces() throws Throwable {
final BaseImpl proxy = AdvancedProxy.createProxy(BaseImpl.class, BaseIEx.class);
assertEquals(proxy.sayA(), "a");
assertEquals(((BaseI)proxy).sayA(), "a");
assertEquals(((BaseIEx)proxy).sayA(), "a");
}
示例12: getStableInvocationHandler
import net.sf.cglib.proxy.AdvancedProxy; //导入依赖的package包/类
public static StableInvocationHandler getStableInvocationHandler(Object proxy)
{
return (StableInvocationHandler) AdvancedProxy.getInvocationHandler(proxy);
}