本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
}