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


Java MethodInvocation.getThis方法代码示例

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


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

示例1: getService

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
/**
 * Retrieve the service instance from which a method was invoked.
 *
 * @param invocation Invoked method
 * @return Service of invoked method
 */
Service getService(MethodInvocation invocation) {
  if (!(invocation.getThis() instanceof Service)) {
    throw new IllegalArgumentException("Invocation target is not a service implementation: " + invocation.getThis());
  }
  return (Service) invocation.getThis();
}
 
开发者ID:mnemonic-no,项目名称:act-platform,代码行数:13,代码来源:AbstractAspect.java

示例2: invoke

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object invoke(final MethodInvocation invocation) throws Throwable {
	// Work out the target class: may be {@code null}.
	// The TransactionAttributeSource should be passed the target class
	// as well as the method, which may be from an interface.
	Class<?> targetClass = (invocation.getThis() != null ? AopUtils.getTargetClass(invocation.getThis()) : null);

	// Adapt to TransactionAspectSupport's invokeWithinTransaction...
	return invokeWithinTransaction(invocation.getMethod(), targetClass, new InvocationCallback() {
		@Override
		public Object proceedWithInvocation() throws Throwable {
			return invocation.proceed();
		}
	});
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:TransactionInterceptor.java

示例3: invokeHandlerMethod

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
private void invokeHandlerMethod(MethodInvocation mi, Throwable ex, Method method) throws Throwable {
	Object[] handlerArgs;
	if (method.getParameterTypes().length == 1) {
		handlerArgs = new Object[] { ex };
	}
	else {
		handlerArgs = new Object[] {mi.getMethod(), mi.getArguments(), mi.getThis(), ex};
	}
	try {
		method.invoke(this.throwsAdvice, handlerArgs);
	}
	catch (InvocationTargetException targetEx) {
		throw targetEx.getTargetException();
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:ThrowsAdviceInterceptor.java

示例4: invoke

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
public Object invoke(final MethodInvocation invocation) throws Throwable {
    Method method = invocation.getMethod();
    Object obj = invocation.getThis();
    CacheInvokeConfig cac = null;
    if (obj != null) {
        String key = CachePointcut.getKey(method, obj.getClass());
        cac  = cacheConfigMap.get(key);
    }

    /*
    if(logger.isTraceEnabled()){
        logger.trace("JetCacheInterceptor invoke. foundJetCacheConfig={}, method={}.{}(), targetClass={}",
                cac != null,
                method.getDeclaringClass().getName(),
                method.getName(),
                invocation.getThis() == null ? null : invocation.getThis().getClass().getName());
    }
    */

    if (cac == null) {
        return invocation.proceed();
    }

    if (globalCacheConfig == null) {
        globalCacheConfig = applicationContext.getBean(GlobalCacheConfig.class);
    }
    CacheInvokeContext context = globalCacheConfig.getCacheContext().createCacheInvokeContext();
    context.setInvoker(invocation::proceed);
    context.setMethod(method);
    context.setArgs(invocation.getArguments());
    context.setCacheInvokeConfig(cac);
    context.setHiddenPackages(globalCacheConfig.getHiddenPackages());
    return CacheHandler.invoke(context);
}
 
开发者ID:alibaba,项目名称:jetcache,代码行数:35,代码来源:JetCacheInterceptor.java

示例5: invoke

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
public Object invoke(MethodInvocation invocation) throws Throwable {
	Method method=invocation.getMethod();
	Class<?> targetClass = (invocation.getThis() != null ? AopUtils.getTargetClass(invocation.getThis()) : null);
	this.doInterceptors(true, targetClass, method, invocation.getArguments(), null);
	Object retVal = invocation.proceed();
	this.doInterceptors(false, targetClass, method, invocation.getArguments(), retVal);
	return retVal;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:9,代码来源:GlobalMethodInterceptor.java

示例6: invoke

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object invoke(MethodInvocation invocation) throws Throwable // NOSONAR
{
	Class<?> targetClass = (invocation.getThis() != null ? invocation.getThis().getClass() : null);

	final SecurityAttribute secAttr = attributeSource.getAttribute(invocation.getMethod(), targetClass);
	if( CurrentUser.getUserState().isSystem() )
	{
		return invocation.proceed();
	}
	if( secAttr.isSystemOnly() )
	{
		throw new AccessDeniedException("You must be the system administrator"); //$NON-NLS-1$
	}
	Object domainObj = null;
	Set<String> onCallPrivs = secAttr.getOnCallPrivileges();
	if( !Check.isEmpty(onCallPrivs) && secAttr.getOnCallmode() != null )
	{
		switch( secAttr.getOnCallmode() )
		{
			case DOMAIN:
				domainObj = invocation.getArguments()[secAttr.getDomainArg()]; // NOSONAR
				// Let it fall through
			case TOPLEVEL:
				if( tleAclManager.filterNonGrantedPrivileges(domainObj, onCallPrivs).isEmpty() )
				{
					throwAccessDenied(onCallPrivs);
				}
				break;
			case ANY:
				if( tleAclManager.filterNonGrantedPrivileges(onCallPrivs).isEmpty() )
				{
					throwAccessDenied(onCallPrivs);
				}
				break;
		}
	}
	if( secAttr.isFilterMatching() )
	{
		return filterResult(invocation, secAttr);
	}
	return invocation.proceed();
}
 
开发者ID:equella,项目名称:Equella,代码行数:44,代码来源:MethodSecurityInteceptor.java

示例7: getLoggerForInvocation

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
/**
 * Return the appropriate {@code Log} instance to use for the given
 * {@code MethodInvocation}. If the {@code useDynamicLogger} flag
 * is set, the {@code Log} instance will be for the target class of the
 * {@code MethodInvocation}, otherwise the {@code Log} will be the
 * default static logger.
 * @param invocation the {@code MethodInvocation} being traced
 * @return the {@code Log} instance to use
 * @see #setUseDynamicLogger
 */
protected Log getLoggerForInvocation(MethodInvocation invocation) {
	if (this.defaultLogger != null) {
		return this.defaultLogger;
	}
	else {
		Object target = invocation.getThis();
		return LogFactory.getLog(getClassForLogging(target));
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:AbstractTraceInterceptor.java


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