當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。