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


Java AdvisedSupport类代码示例

本文整理汇总了Java中org.springframework.aop.framework.AdvisedSupport的典型用法代码示例。如果您正苦于以下问题:Java AdvisedSupport类的具体用法?Java AdvisedSupport怎么用?Java AdvisedSupport使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getObject

import org.springframework.aop.framework.AdvisedSupport; //导入依赖的package包/类
public Object getObject ( final String command ) throws Exception {
    final Object templates = Gadgets.createTemplatesImpl(command);

    AdvisedSupport as = new AdvisedSupport();
    as.setTargetSource(new SingletonTargetSource(templates));

    final Type typeTemplatesProxy = Gadgets.createProxy(
        (InvocationHandler) Reflections.getFirstCtor("org.springframework.aop.framework.JdkDynamicAopProxy").newInstance(as),
        Type.class,
        Templates.class);

    final Object typeProviderProxy = Gadgets.createMemoitizedProxy(
        Gadgets.createMap("getType", typeTemplatesProxy),
        forName("org.springframework.core.SerializableTypeWrapper$TypeProvider"));

    Object mitp = Reflections.createWithoutConstructor(forName("org.springframework.core.SerializableTypeWrapper$MethodInvokeTypeProvider"));
    Reflections.setFieldValue(mitp, "provider", typeProviderProxy);
    Reflections.setFieldValue(mitp, "methodName", "newTransformer");
    return mitp;
}
 
开发者ID:hucheat,项目名称:APacheSynapseSimplePOC,代码行数:21,代码来源:Spring2.java

示例2: getCglibProxyTargetObject

import org.springframework.aop.framework.AdvisedSupport; //导入依赖的package包/类
private static Object getCglibProxyTargetObject(Object proxy) throws Exception {
	Field field = proxy.getClass().getDeclaredField("CGLIB$CALLBACK_0");
       field.setAccessible(true);
       Object dynamicAdvisedInterceptor = field.get(proxy);
       
       Field advised = dynamicAdvisedInterceptor.getClass().getDeclaredField("advised");
       advised.setAccessible(true);
       
       Object target = ((AdvisedSupport)advised.get(dynamicAdvisedInterceptor)).getTargetSource().getTarget();

       if(!AopUtils.isAopProxy(target)){
		throw new EndRecursionException(target);
	}
	getCglibProxyTargetObject(target);
       return null;
}
 
开发者ID:Yanweichen,项目名称:SimpleProcessControl,代码行数:17,代码来源:AopTargetUtils.java

示例3: getObject

import org.springframework.aop.framework.AdvisedSupport; //导入依赖的package包/类
public Object getObject ( CmdExecuteHelper cmdHelper ) throws Exception {
    final Object templates = Gadgets.createTemplatesImpl(cmdHelper.getCommandArray());

    AdvisedSupport as = new AdvisedSupport();
    as.setTargetSource(new SingletonTargetSource(templates));

    final Type typeTemplatesProxy = Gadgets.createProxy(
        (InvocationHandler) Reflections.getFirstCtor("org.springframework.aop.framework.JdkDynamicAopProxy").newInstance(as),
        Type.class,
        Templates.class);

    final Object typeProviderProxy = Gadgets.createMemoitizedProxy(
        Gadgets.createMap("getType", typeTemplatesProxy),
        forName("org.springframework.core.SerializableTypeWrapper$TypeProvider"));

    Object mitp = Reflections.createWithoutConstructor(forName("org.springframework.core.SerializableTypeWrapper$MethodInvokeTypeProvider"));
    Reflections.setFieldValue(mitp, "provider", typeProviderProxy);
    Reflections.setFieldValue(mitp, "methodName", "newTransformer");
    return mitp;
}
 
开发者ID:pimps,项目名称:ysoserial-modified,代码行数:21,代码来源:Spring2.java

示例4: makeCallerChain

import org.springframework.aop.framework.AdvisedSupport; //导入依赖的package包/类
/**
 * Will call all getter methods on payload that are defined in the given interfaces
 */
public static Map makeCallerChain ( Object payload, Class... ifaces ) throws OpenDataException, NoSuchMethodException, InstantiationException,
        IllegalAccessException, InvocationTargetException, Exception, ClassNotFoundException {
    CompositeType rt = new CompositeType("a", "b", new String[] {
        "a"
    }, new String[] {
        "a"
    }, new OpenType[] {
        javax.management.openmbean.SimpleType.INTEGER
    });
    TabularType tt = new TabularType("a", "b", rt, new String[] {
        "a"
    });
    TabularDataSupport t1 = new TabularDataSupport(tt);
    TabularDataSupport t2 = new TabularDataSupport(tt);

    // we need to make payload implement composite data
    // it's very likely that there are other proxy impls that could be used
    AdvisedSupport as = new AdvisedSupport();
    as.setTarget(payload);
    InvocationHandler delegateInvocationHandler = (InvocationHandler) Reflections
            .getFirstCtor("org.springframework.aop.framework.JdkDynamicAopProxy").newInstance(as);
    InvocationHandler cdsInvocationHandler = Gadgets.createMemoizedInvocationHandler(Gadgets.createMap("getCompositeType", rt));
    CompositeInvocationHandlerImpl invocationHandler = new CompositeInvocationHandlerImpl();
    invocationHandler.addInvocationHandler(CompositeData.class, cdsInvocationHandler);
    invocationHandler.setDefaultHandler(delegateInvocationHandler);
    final CompositeData cdsProxy = Gadgets.createProxy(invocationHandler, CompositeData.class, ifaces);

    JSONObject jo = new JSONObject();
    Map m = new HashMap();
    m.put("t", cdsProxy);
    Reflections.setFieldValue(jo, "properties", m);
    Reflections.setFieldValue(jo, "properties", m);
    Reflections.setFieldValue(t1, "dataMap", jo);
    Reflections.setFieldValue(t2, "dataMap", jo);
    return Gadgets.makeMap(t1, t2);
}
 
开发者ID:hucheat,项目名称:APacheSynapseSimplePOC,代码行数:40,代码来源:JSON1.java

示例5: getCglibProxyTargetObject

import org.springframework.aop.framework.AdvisedSupport; //导入依赖的package包/类
private Object getCglibProxyTargetObject(Object proxy) throws Exception {
	Field h = proxy.getClass().getDeclaredField("CGLIB$CALLBACK_0");
	h.setAccessible(true);
	Object dynamicAdvisedInterceptor = h.get(proxy);
	Field advised = dynamicAdvisedInterceptor.getClass().getDeclaredField("advised");
	advised.setAccessible(true);

	Object target = ((AdvisedSupport)advised.get(dynamicAdvisedInterceptor)).getTargetSource().getTarget();

	return target;
}
 
开发者ID:youseries,项目名称:urule,代码行数:12,代码来源:ActionServletHandler.java

示例6: getJdkDynamicProxyTargetObject

import org.springframework.aop.framework.AdvisedSupport; //导入依赖的package包/类
private Object getJdkDynamicProxyTargetObject(Object proxy) throws Exception {
	Field h = proxy.getClass().getSuperclass().getDeclaredField("h");
	h.setAccessible(true);
	AopProxy aopProxy = (AopProxy) h.get(proxy);
	Field advised = aopProxy.getClass().getDeclaredField("advised");
	advised.setAccessible(true);
	Object target = ((AdvisedSupport)advised.get(aopProxy)).getTargetSource().getTarget();
	return target;
}
 
开发者ID:youseries,项目名称:urule,代码行数:10,代码来源:ActionServletHandler.java

示例7: getJdkDynamicProxyTargetObject

import org.springframework.aop.framework.AdvisedSupport; //导入依赖的package包/类
private static Object getJdkDynamicProxyTargetObject(Object proxy) throws Exception {
  Field h = proxy.getClass().getSuperclass().getDeclaredField("h");
  h.setAccessible(true);
  AopProxy aopProxy = (AopProxy) h.get(proxy);
  Field advised = aopProxy.getClass().getDeclaredField("advised");
  advised.setAccessible(true);
  Object target = ((AdvisedSupport) advised.get(aopProxy)).getTargetSource().getTarget();
  return target;
}
 
开发者ID:venus-boot,项目名称:saluki,代码行数:10,代码来源:GrpcAop.java

示例8: getJdkDynamicProxyTargetObject

import org.springframework.aop.framework.AdvisedSupport; //导入依赖的package包/类
private static Object getJdkDynamicProxyTargetObject(Object proxy) throws Exception {
	Field field = proxy.getClass().getSuperclass().getDeclaredField("h");
       field.setAccessible(true);
       AopProxy aopProxy = (AopProxy) field.get(proxy);
       
       Field advised = aopProxy.getClass().getDeclaredField("advised");
       advised.setAccessible(true);
       
       Object target = ((AdvisedSupport)advised.get(aopProxy)).getTargetSource().getTarget();
	if(!AopUtils.isAopProxy(target)){
		throw new EndRecursionException(target);
	}
	getJdkDynamicProxyTargetObject(target);
       return null;
}
 
开发者ID:Yanweichen,项目名称:SimpleProcessControl,代码行数:16,代码来源:AopTargetUtils.java

示例9: getCglibProxyTargetObject

import org.springframework.aop.framework.AdvisedSupport; //导入依赖的package包/类
private static Object getCglibProxyTargetObject(Object proxy) throws Exception {
    Field h = proxy.getClass().getDeclaredField("CGLIB$CALLBACK_0");
    h.setAccessible(true);
    Object dynamicAdvisedInterceptor = h.get(proxy);

    Field advised = dynamicAdvisedInterceptor.getClass().getDeclaredField("advised");
    advised.setAccessible(true);

    Object target = ((AdvisedSupport) advised.get(dynamicAdvisedInterceptor)).getTargetSource().getTarget();

    return target;
}
 
开发者ID:warlock-china,项目名称:azeroth,代码行数:13,代码来源:SpringAopHelper.java

示例10: getJdkDynamicProxyTargetObject

import org.springframework.aop.framework.AdvisedSupport; //导入依赖的package包/类
private static Object getJdkDynamicProxyTargetObject(Object proxy) throws Exception {
    Field h = proxy.getClass().getSuperclass().getDeclaredField("h");
    h.setAccessible(true);
    AopProxy aopProxy = (AopProxy) h.get(proxy);

    Field advised = aopProxy.getClass().getDeclaredField("advised");
    advised.setAccessible(true);

    Object target = ((AdvisedSupport) advised.get(aopProxy)).getTargetSource().getTarget();

    return target;
}
 
开发者ID:warlock-china,项目名称:azeroth,代码行数:13,代码来源:SpringAopHelper.java

示例11: getCglibProxyTargetObject

import org.springframework.aop.framework.AdvisedSupport; //导入依赖的package包/类
private static Object getCglibProxyTargetObject(Object proxy) throws Exception {  
    Field h = proxy.getClass().getDeclaredField("CGLIB$CALLBACK_0");
    h.setAccessible(true);  
    Object dynamicAdvisedInterceptor = h.get(proxy);  
      
    Field advised = dynamicAdvisedInterceptor.getClass().getDeclaredField("advised");  
    advised.setAccessible(true);  
      
    Object target = ((AdvisedSupport)advised.get(dynamicAdvisedInterceptor)).getTargetSource().getTarget();  
      
    return target;  
}
 
开发者ID:devpage,项目名称:fastdfs-quickstart,代码行数:13,代码来源:AopTargetUtils.java

示例12: getJdkDynamicProxyTargetObject

import org.springframework.aop.framework.AdvisedSupport; //导入依赖的package包/类
private static Object getJdkDynamicProxyTargetObject(Object proxy) throws Exception {  
    Field h = proxy.getClass().getSuperclass().getDeclaredField("h");  
    h.setAccessible(true);  
    AopProxy aopProxy = (AopProxy) h.get(proxy);  
    Field advised = aopProxy.getClass().getDeclaredField("advised");  
    advised.setAccessible(true);  
    Object target = ((AdvisedSupport)advised.get(aopProxy)).getTargetSource().getTarget();  
    return target;  
}
 
开发者ID:devpage,项目名称:fastdfs-quickstart,代码行数:10,代码来源:AopTargetUtils.java

示例13: getCglibProxyTargetObject

import org.springframework.aop.framework.AdvisedSupport; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static <T> T getCglibProxyTargetObject(T proxy) {
    try {
        Field h = proxy.getClass().getDeclaredField("CGLIB$CALLBACK_0");
        h.setAccessible(true);
        Object dynamicAdvisedInterceptor = h.get(proxy);

        Field advised = dynamicAdvisedInterceptor.getClass().getDeclaredField("advised");
        advised.setAccessible(true);

        return (T) ((AdvisedSupport) advised.get(dynamicAdvisedInterceptor)).getTargetSource().getTarget();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:16,代码来源:ProxyUtils.java

示例14: setUp

import org.springframework.aop.framework.AdvisedSupport; //导入依赖的package包/类
@Before
public void setUp() {
	converter = new Jaxb2RootElementHttpMessageConverter();
	rootElement = new RootElement();
	DefaultAopProxyFactory proxyFactory = new DefaultAopProxyFactory();
	AdvisedSupport advisedSupport = new AdvisedSupport();
	advisedSupport.setTarget(rootElement);
	advisedSupport.setProxyTargetClass(true);
	AopProxy proxy = proxyFactory.createAopProxy(advisedSupport);
	rootElementCglib = (RootElement) proxy.getProxy();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:12,代码来源:Jaxb2RootElementHttpMessageConverterTests.java

示例15: getCglibProxyTargetObject

import org.springframework.aop.framework.AdvisedSupport; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static <T> T getCglibProxyTargetObject(Object proxy) {
	try {
		Field h = proxy.getClass().getDeclaredField("CGLIB$CALLBACK_0");
		h.setAccessible(true);
		Object dynamicAdvisedInterceptor = h.get(proxy);
		Field advised = dynamicAdvisedInterceptor.getClass().getDeclaredField("advised");
		advised.setAccessible(true);
		return (T) (((AdvisedSupport) advised.get(dynamicAdvisedInterceptor)).getTargetSource().getTarget());
	}
	catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:slyak,项目名称:spring-data-jpa-extra,代码行数:15,代码来源:AopTargetUtils.java


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