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


Java AdvancedProxy.createProxy方法代码示例

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


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

示例1: _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

示例2: 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

示例3: 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

示例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()]));
  //myMergedMap.get(aClass).put(implementations, t);
  return t;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:ModelMergerImpl.java

示例5: 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

示例6: 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

示例7: 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


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