本文整理汇总了Java中org.aopalliance.intercept.MethodInvocation.proceed方法的典型用法代码示例。如果您正苦于以下问题:Java MethodInvocation.proceed方法的具体用法?Java MethodInvocation.proceed怎么用?Java MethodInvocation.proceed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.aopalliance.intercept.MethodInvocation
的用法示例。
在下文中一共展示了MethodInvocation.proceed方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: filterResult
import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private Object filterResult(MethodInvocation invocation, final SecurityAttribute secAttr) throws Throwable // NOSONAR
{
Object returnedObject = invocation.proceed();
if( returnedObject == null )
{
return null;
}
if( returnedObject instanceof Collection )
{
return filterCollection(secAttr, (Collection<Object>) returnedObject);
}
else if( returnedObject instanceof Map )
{
return filterMap(secAttr, (Map<Object, Object>) returnedObject);
}
else
{
checkSingleObject(secAttr.getFilterPrivileges(), returnedObject);
return returnedObject;
}
}
示例2: invoke
import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
public Object invoke(MethodInvocation invocation) throws Throwable
{
ACLEntryVoter voter = new ACLEntryVoter();
voter.setNamespacePrefixResolver(namespacePrefixResolver);
voter.setPermissionService(permissionService);
voter.setNodeService(nodeService);
voter.setAuthenticationService(authenticationService);
voter.setAuthorityService(authorityService);
// TODO: add explicit abstain tests (for now, configure dummy "abstainFor" to test deleted nodes - see ALF-898)
Set<String> abstainFor = new HashSet<String>(1);
abstainFor.add("{http://www.alfresco.org/model/content/1.0}emailed");
voter.setAbstainFor(abstainFor);
voter.afterPropertiesSet();
if (!(voter.vote(null, invocation, cad) == AccessDecisionVoter.ACCESS_DENIED))
{
return invocation.proceed();
}
else
{
throw new ACLEntryVoterException("Access denied");
}
}
示例3: intercept
import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
MethodInvocation invocation = new CglibMethodInvocation(proxy, this.target, method, args,
this.targetClass, this.adviceChain, methodProxy);
// If we get here, we need to create a MethodInvocation.
Object retVal = invocation.proceed();
retVal = processReturnType(proxy, this.target, method, retVal);
return retVal;
}
示例4: proceed
import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
/**
* Allow the given method invocation to proceed, auditing values before invocation and
* after returning or throwing.
*
* @param mi the invocation
* @return Returns the method return (if a value is not thrown)
* @throws Throwable rethrows any exception generated by the invocation
*
* @since 3.2
*/
private Object proceed(MethodInvocation mi) throws Throwable
{
// Are we in a nested audit?
Boolean wasInAudit = inAudit.get();
try
{
// If we are already in a nested audit call, there is nothing to do
if (Boolean.TRUE.equals(wasInAudit))
{
return mi.proceed();
}
Auditable auditableDef = mi.getMethod().getAnnotation(Auditable.class);
if (auditableDef == null)
{
// No annotation, so just continue as normal
return mi.proceed();
}
// First get the argument map, if present
Object[] args = mi.getArguments();
Map<String, Serializable> namedArguments = getInvocationArguments(auditableDef, args);
// Get the service name
String serviceName = beanIdentifier.getBeanName(mi);
if (serviceName == null)
{
// Not a public service
return mi.proceed();
}
String methodName = mi.getMethod().getName();
return proceedWithAudit(mi, auditableDef, serviceName, methodName, namedArguments);
}
finally
{
inAudit.set(wasInAudit);
}
}
示例5: invoke
import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object invoke ( MethodInvocation invocation ) throws Throwable {
final String packageName = invocation.getThis().getClass().getPackage().getName();
if ( packageName.contains( "user" ) ) {
setDataSourceKey( invocation.getMethod() , GlobalConstant.USER_DATA_SOURCE_KEY );
}
if ( packageName.contains( "order" ) ) {
setDataSourceKey( invocation.getMethod() , GlobalConstant.ORDER_DATA_SOURCE_KEY );
}
return invocation.proceed();
}
开发者ID:yujunhao8831,项目名称:spring-boot-mybatisplus-multiple-datasource,代码行数:12,代码来源:DataSourceSwitchMethodInterceptor.java
示例6: invoke
import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
System.out.println("====[proxy] start: " + new Date());
Object result = invocation.proceed();
System.out.println("====[proxy] end: " + new Date());
return result;
}
开发者ID:fangjian0423,项目名称:springboot-analysis,代码行数:8,代码来源:SimpleInstantiationAwareBeanPostProcessor.java
示例7: invoke
import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
if (invocation.getMethod().getName().equals("getConnection")) {
if (invocation.getMethod().getParameterCount() == 0) {
return decoratedDataSource.getConnection();
}
else if (invocation.getMethod().getParameterCount() == 2) {
return decoratedDataSource.getConnection((String) invocation.getArguments()[0], (String) invocation.getArguments()[1]);
}
}
if (invocation.getMethod().getName().equals("toString")) {
return decoratingChain.stream()
.map(entry -> entry.getBeanName() + " [" + entry.getDataSource().getClass().getName() + "]")
.collect(Collectors.joining(" -> ")) + " -> " + beanName + " [" + realDataSource.getClass().getName() + "]";
}
if (invocation.getMethod().getDeclaringClass() == DecoratedDataSource.class) {
if (invocation.getMethod().getName().equals("getRealDataSource")) {
return realDataSource;
}
if (invocation.getMethod().getName().equals("getDecoratedDataSource")) {
return decoratedDataSource;
}
if (invocation.getMethod().getName().equals("getDecoratingChain")) {
return Collections.unmodifiableList(decoratingChain);
}
}
return invocation.proceed();
}
开发者ID:gavlyukovskiy,项目名称:spring-boot-data-source-decorator,代码行数:29,代码来源:DataSourceDecoratorInterceptor.java
示例8: invoke
import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
Service service = getService(invocation);
if (RequestContext.isSet()) {
return invocation.proceed();
}
try (RequestContext ignored = RequestContext.set(service.createRequestContext())) {
return invocation.proceed();
}
}
示例9: invoke
import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
String methodName = invocation.getMethod().getName();
if(exclude.contains(methodName)) {
return invocation.proceed();
}
long start = System.currentTimeMillis();
Object result = invocation.proceed();
long end = System.currentTimeMillis();
logger.info("====method({}), cost({}) ", methodName, (end - start));
return result;
}
示例10: invoke
import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object invoke(MethodInvocation mi) throws Throwable {
try {
return mi.proceed();
}
finally {
invokeAdviceMethod(getJoinPointMatch(), null, null);
}
}
示例11: invoke
import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object invoke(@SuppressWarnings("null") MethodInvocation invocation) throws Throwable {
INFO.set(invocation);
try {
return invocation.proceed();
} finally {
INFO.remove();
}
}
示例12: invoke
import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
public Object invoke(final MethodInvocation methodInvocation) throws Throwable
{
// Just check for any transaction
if (AlfrescoTransactionSupport.getTransactionReadState() == TxnReadState.TXN_NONE)
{
String methodName = methodInvocation.getMethod().getName();
String className = methodInvocation.getMethod().getDeclaringClass().getName();
throw new AlfrescoRuntimeException(
"A transaction has not be started for method '" + methodName + "' on " + className);
}
return methodInvocation.proceed();
}
示例13: invoke
import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object invoke(MethodInvocation mi) throws Throwable {
if (!(mi instanceof ProxyMethodInvocation)) {
throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi);
}
ProxyMethodInvocation pmi = (ProxyMethodInvocation) mi;
pmi.setUserAttribute(BEAN_NAME_ATTRIBUTE, this.beanName);
return mi.proceed();
}
示例14: invoke
import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
public Object invoke(MethodInvocation mi) throws Throwable
{
while (true)
{
try
{
MethodInvocation clone = ((ReflectiveMethodInvocation)mi).invocableClone();
return clone.proceed();
}
catch (AuthenticationException ae)
{
// Sleep for an interval and try again.
try
{
Thread.sleep(fRetryInterval);
}
catch (InterruptedException ie)
{
// Do nothing.
}
try
{
// Reauthenticate.
fAuthService.authenticate(fUser, fPassword.toCharArray());
String ticket = fAuthService.getCurrentTicket();
fTicketHolder.setTicket(ticket);
// Modify the ticket argument.
mi.getArguments()[0] = ticket;
}
catch (Exception e)
{
// Do nothing.
}
}
}
}
示例15: invoke
import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
public Object invoke(MethodInvocation invocation) throws Throwable {
return "aop:" + invocation.proceed();
}