• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java AspectJAroundAdvice类的典型用法和代码示例

java 1次浏览

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

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

示例1: getAdviceClass

点赞 3

import org.springframework.aop.aspectj.AspectJAroundAdvice; //导入依赖的package包/类
/**
 * Gets the advice implementation class corresponding to the supplied {@link Element}.
 */
private Class<?> getAdviceClass(Element adviceElement, ParserContext parserContext) {
	String elementName = parserContext.getDelegate().getLocalName(adviceElement);
	if (BEFORE.equals(elementName)) {
		return AspectJMethodBeforeAdvice.class;
	}
	else if (AFTER.equals(elementName)) {
		return AspectJAfterAdvice.class;
	}
	else if (AFTER_RETURNING_ELEMENT.equals(elementName)) {
		return AspectJAfterReturningAdvice.class;
	}
	else if (AFTER_THROWING_ELEMENT.equals(elementName)) {
		return AspectJAfterThrowingAdvice.class;
	}
	else if (AROUND.equals(elementName)) {
		return AspectJAroundAdvice.class;
	}
	else {
		throw new IllegalArgumentException("Unknown advice kind [" + elementName + "].");
	}
}
 

开发者ID:lamsfoundation,
项目名称:lams,
代码行数:25,
代码来源:ConfigBeanDefinitionParser.java

示例2: makeBeanFactoryTriggerPCAH

点赞 3

import org.springframework.aop.aspectj.AspectJAroundAdvice; //导入依赖的package包/类
/**
 * @param jndiUrl
 * @param bf
 * @return
 * @throws ClassNotFoundException
 * @throws NoSuchMethodException
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws InvocationTargetException
 * @throws Exception
 */
public static Object makeBeanFactoryTriggerPCAH ( UtilFactory uf, String name, BeanFactory bf ) throws ClassNotFoundException,
        NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException, Exception {
    AspectInstanceFactory aif = Reflections.createWithoutConstructor(BeanFactoryAspectInstanceFactory.class);
    Reflections.setFieldValue(aif, "beanFactory", bf);
    Reflections.setFieldValue(aif, "name", name);
    AbstractAspectJAdvice advice = Reflections.createWithoutConstructor(AspectJAroundAdvice.class);
    Reflections.setFieldValue(advice, "aspectInstanceFactory", aif);

    // make readObject happy if it is called
    Reflections.setFieldValue(advice, "declaringClass", Object.class);
    Reflections.setFieldValue(advice, "methodName", "toString");
    Reflections.setFieldValue(advice, "parameterTypes", new Class[0]);

    AspectJPointcutAdvisor advisor = Reflections.createWithoutConstructor(AspectJPointcutAdvisor.class);
    Reflections.setFieldValue(advisor, "advice", advice);

    Class<?> pcahCl = Class
            .forName("org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator$PartiallyComparableAdvisorHolder");
    Object pcah = Reflections.createWithoutConstructor(pcahCl);
    Reflections.setFieldValue(pcah, "advisor", advisor);
    return uf.makeToStringTriggerUnstable(pcah);
}
 

开发者ID:mbechler,
项目名称:marshalsec,
代码行数:34,
代码来源:SpringUtil.java

示例3: getAdviceClass

点赞 3

import org.springframework.aop.aspectj.AspectJAroundAdvice; //导入依赖的package包/类
/**
 * Gets the advice implementation class corresponding to the supplied {@link Element}.
 */
private Class getAdviceClass(Element adviceElement, ParserContext parserContext) {
	String elementName = parserContext.getDelegate().getLocalName(adviceElement);
	if (BEFORE.equals(elementName)) {
		return AspectJMethodBeforeAdvice.class;
	}
	else if (AFTER.equals(elementName)) {
		return AspectJAfterAdvice.class;
	}
	else if (AFTER_RETURNING_ELEMENT.equals(elementName)) {
		return AspectJAfterReturningAdvice.class;
	}
	else if (AFTER_THROWING_ELEMENT.equals(elementName)) {
		return AspectJAfterThrowingAdvice.class;
	}
	else if (AROUND.equals(elementName)) {
		return AspectJAroundAdvice.class;
	}
	else {
		throw new IllegalArgumentException("Unknown advice kind [" + elementName + "].");
	}
}
 

开发者ID:deathspeeder,
项目名称:class-guard,
代码行数:25,
代码来源:ConfigBeanDefinitionParser.java

示例4: createAspectJAroundAdvice

点赞 2

import org.springframework.aop.aspectj.AspectJAroundAdvice; //导入依赖的package包/类
private Advisor createAspectJAroundAdvice(int advisorOrder, int adviceDeclarationOrder, String aspectName) {
	AspectJAroundAdvice advice = new AspectJAroundAdvice(this.anyOldMethod, this.anyOldPointcut, null);
	return createAspectJAdvice(advisorOrder, adviceDeclarationOrder, aspectName, advice);
}
 

开发者ID:langtianya,
项目名称:spring4-understanding,
代码行数:5,
代码来源:AspectJPrecedenceComparatorTests.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)