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


Java AdvancedProxy类代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:DomManagerImpl.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:DomManagerImpl.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:25,代码来源:DomManagerImpl.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ModelMergerImpl.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:DomInvocationHandler.java

示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:ProxyTest.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:ModelMergerImpl.java

示例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);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:DomInvocationHandler.java

示例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);
  }
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:29,代码来源:DomInvocationHandler.java

示例10: getStableInvocationHandler

import net.sf.cglib.proxy.AdvancedProxy; //导入依赖的package包/类
public static StableInvocationHandler getStableInvocationHandler(Object proxy) {
  return (StableInvocationHandler)AdvancedProxy.getInvocationHandler(proxy);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:DomManagerImpl.java

示例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");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:ProxyTest.java

示例12: getStableInvocationHandler

import net.sf.cglib.proxy.AdvancedProxy; //导入依赖的package包/类
public static StableInvocationHandler getStableInvocationHandler(Object proxy)
{
	return (StableInvocationHandler) AdvancedProxy.getInvocationHandler(proxy);
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:5,代码来源:DomManagerImpl.java


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