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


Java AllArguments类代码示例

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


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

示例1: intercept

import net.bytebuddy.implementation.bind.annotation.AllArguments; //导入依赖的package包/类
/**
 * This is the method that intercepts component container methods in "enhanced" model objects.
 * 
 * @param obj "enhanced" object upon which the method was invoked
 * @param method {@link Method} object for the invoked method
 * @param args method invocation arguments
 * @return {@code anything} (the result of invoking the intercepted method)
 * @throws Exception {@code anything} (exception thrown by the intercepted method)
 */
@RuntimeType
@BindingPriority(Integer.MAX_VALUE)
public Object intercept(@This Object obj, @Origin Method method, @AllArguments Object[] args) throws Exception
{
    try {
        return method.invoke(getWrappedElement(), args);
    } catch (InvocationTargetException ite) {
        Throwable t = ite.getCause();
        if (t instanceof StaleElementReferenceException) {
            try {
                StaleElementReferenceException sere = (StaleElementReferenceException) t;
                return method.invoke(refreshReference(sere).getWrappedElement(), args);
            } catch (NullPointerException npe) {
                throw deferredException();
            }
        }
        throw UncheckedThrow.throwUnchecked(t);
    }
}
 
开发者ID:Nordstrom,项目名称:Selenium-Foundation,代码行数:29,代码来源:RobustElementFactory.java

示例2: interceptor

import net.bytebuddy.implementation.bind.annotation.AllArguments; //导入依赖的package包/类
@RuntimeType
public Object interceptor(@AllArguments Object[] allArgument, @Origin Method method, @Origin Class<?> clazz,
		@SuperCall Callable<?> zuper) throws Exception {

	Object ret = null;
	try {
		ret = zuper.call();
	} catch (Throwable e) {

		throw e;
	} finally {

	}

	return ret;
}
 
开发者ID:O2O-Market,项目名称:Market-monitor,代码行数:17,代码来源:MethodInputAndOutParameterInterceptor.java

示例3: intercept

import net.bytebuddy.implementation.bind.annotation.AllArguments; //导入依赖的package包/类
@RuntimeType
public Object intercept(@This Object obj,
    @AllArguments Object[] allArguments,
    @SuperCall Callable<?> zuper,
    @Origin Method method
) throws Throwable {
    boolean occurError = false;
    long startNano = System.nanoTime();
    long endNano;
    try {
        return zuper.call();
    } catch (Throwable t) {
        occurError = true;
        throw t;
    } finally {
        endNano = System.nanoTime();
        serviceMetric.trace(method, endNano - startNano, occurError);
    }
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:20,代码来源:ServiceMetricTracing.java

示例4: interceptSuper

import net.bytebuddy.implementation.bind.annotation.AllArguments; //导入依赖的package包/类
@RuntimeType
@BindingPriority( BindingPriority.DEFAULT * 3 )
public Object interceptSuper( @SuperCall final Callable<?> zuper, @This final Object receiver, @Origin Method method,
        @AllArguments final Object[] parameters,
        @FieldProxy( INTERCEPTOR_FIELD_NAME ) StepInterceptorGetterSetter stepInterceptorGetter )
        throws Throwable {

    StepInterceptor interceptor = (StepInterceptor) stepInterceptorGetter.getValue();

    if( interceptor == null ) {
        return zuper.call();
    }

    Invoker invoker = new Invoker() {
        @Override
        public Object proceed() throws Throwable {
            return zuper.call();
        }

    };
    return interceptor.intercept( receiver, method, parameters, invoker );
}
 
开发者ID:TNG,项目名称:JGiven,代码行数:23,代码来源:ByteBuddyMethodInterceptor.java

示例5: interceptDefault

import net.bytebuddy.implementation.bind.annotation.AllArguments; //导入依赖的package包/类
@RuntimeType
@BindingPriority( BindingPriority.DEFAULT * 2 )
public Object interceptDefault( @DefaultCall final Callable<?> zuper, @This final Object receiver, @Origin Method method,
        @AllArguments final Object[] parameters,
        @FieldProxy( INTERCEPTOR_FIELD_NAME ) StepInterceptorGetterSetter stepInterceptorGetter )
        throws Throwable {

    StepInterceptor interceptor = (StepInterceptor) stepInterceptorGetter.getValue();

    if( interceptor == null ) {
        return zuper.call();
    }

    Invoker invoker = new Invoker() {
        @Override
        public Object proceed() throws Throwable {
            return zuper.call();
        }

    };
    return interceptor.intercept( receiver, method, parameters, invoker );
}
 
开发者ID:TNG,项目名称:JGiven,代码行数:23,代码来源:ByteBuddyMethodInterceptor.java

示例6: intercept

import net.bytebuddy.implementation.bind.annotation.AllArguments; //导入依赖的package包/类
@RuntimeType
public Object intercept( @This final Object receiver, @Origin final Method method,
                         @AllArguments final Object[] parameters,
                         @FieldProxy( INTERCEPTOR_FIELD_NAME ) StepInterceptorGetterSetter stepInterceptorGetter)
        throws Throwable {
    // this intercepted method does not have a non-abstract super method
    StepInterceptor interceptor = (StepInterceptor) stepInterceptorGetter.getValue();

    if( interceptor == null ) {
        return null;
    }

    Invoker invoker = new Invoker() {

        @Override
        public Object proceed() throws Throwable {
            return null;
        }

    };
    return interceptor.intercept( receiver, method, parameters, invoker );
}
 
开发者ID:TNG,项目名称:JGiven,代码行数:23,代码来源:ByteBuddyMethodInterceptor.java

示例7: execute

import net.bytebuddy.implementation.bind.annotation.AllArguments; //导入依赖的package包/类
@RuntimeType
public static Object execute(@This final ElementFrame thisFrame, @Origin final Method method, @RuntimeType @AllArguments final Object[] args)
{
    final MapInProperties ann = ((CachesReflection) thisFrame).getReflectionCache().getAnnotation(method, MapInProperties.class);

    Element thisElement = thisFrame.getElement();
    if (!(thisElement instanceof Vertex))
        throw new WindupException("Element is not of supported type, must be Vertex, but was: " + thisElement.getClass().getCanonicalName());
    Vertex vertex = (Vertex) thisElement;

    String methodName = method.getName();
    if (methodName.startsWith("get"))
        return handleGetter(vertex, method, args, ann);

    if (methodName.startsWith("set"))
        return handleSetter(vertex, method, args, ann);

    if (methodName.startsWith("put"))
        return handleAdder(vertex, method, args, ann);

    if (methodName.startsWith("putAll"))
        return handleAdder(vertex, method, args, ann);

    throw new WindupException("Only get*, set*, and put* method names are supported for @"
                + MapInProperties.class.getSimpleName() + ", found at: " + method.getName());
}
 
开发者ID:windup,项目名称:windup,代码行数:27,代码来源:MapInPropertiesHandler.java

示例8: execute

import net.bytebuddy.implementation.bind.annotation.AllArguments; //导入依赖的package包/类
@RuntimeType
public static Object execute(@This final ElementFrame thisFrame, @Origin final Method method, @RuntimeType @AllArguments final Object[] args)
{
    final MapInAdjacentVertices ann = ((CachesReflection) thisFrame).getReflectionCache().getAnnotation(method, MapInAdjacentVertices.class);

    Element thisElement = thisFrame.getElement();
    if (!(thisElement instanceof Vertex))
        throw new WindupException("Element is not of supported type, must be Vertex, but was: " + thisElement.getClass().getCanonicalName());
    Vertex vertex = (Vertex) thisElement;

    String methodName = method.getName();
    if (methodName.startsWith("get"))
    {
        return handleGetter(vertex, method, args, ann, thisFrame.getGraph());
    }
    else if (methodName.startsWith("set"))
    {
        handleSetter((VertexFrame)thisFrame, method, args, ann, thisFrame.getGraph());
        return null;
    }

    throw new WindupException("Only get* and set* method names are supported.");
}
 
开发者ID:windup,项目名称:windup,代码行数:24,代码来源:MapInAdjacentVerticesHandler.java

示例9: execute

import net.bytebuddy.implementation.bind.annotation.AllArguments; //导入依赖的package包/类
@RuntimeType
public static Object execute(@This final ElementFrame thisFrame, @Origin final Method method, @RuntimeType @AllArguments final Object[] args)
{
    final MapInAdjacentProperties ann = ((CachesReflection) thisFrame).getReflectionCache().getAnnotation(method, MapInAdjacentProperties.class);

    Element thisElement = thisFrame.getElement();
    if (!(thisElement instanceof Vertex))
        throw new WindupException("Element is not of supported type, must be Vertex, but was: " + thisElement.getClass().getCanonicalName());
    Vertex vertex = (Vertex) thisElement;

    String methodName = method.getName();
    if (methodName.startsWith("get"))
        return handleGetter(vertex, method, args, ann);

    if (methodName.startsWith("set"))
    {
        handleSetter(vertex, method, args, ann, thisFrame.getGraph());
        return null;
    }

    throw new WindupException("Only get* and set* method names are supported for @" + MapInAdjacentProperties.class.getSimpleName());
}
 
开发者ID:windup,项目名称:windup,代码行数:23,代码来源:MapInAdjacentPropertiesHandler.java

示例10: intercept

import net.bytebuddy.implementation.bind.annotation.AllArguments; //导入依赖的package包/类
@RuntimeType
public static Object intercept(
        @Origin Method method,
        @AllArguments Object[] args,
        @FieldValue("liveObjectLiveMap") RMap<?, ?> map
) throws Exception {
    Class<?>[] cls = new Class[args.length];
    for (int i = 0; i < args.length; i++) {
        cls[i] = args[i].getClass();
    }
    return ClassUtils.searchForMethod(RMap.class, method.getName(), cls).invoke(map, args);
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:13,代码来源:RMapInterceptor.java

示例11: intercept

import net.bytebuddy.implementation.bind.annotation.AllArguments; //导入依赖的package包/类
@RuntimeType
public static Object intercept(
        @Origin Method method,
        @AllArguments Object[] args,
        @FieldValue("liveObjectLiveMap") RMap<?, ?> map
) throws Exception {
    throw new UnsupportedOperationException("Please use RLiveObjectService instance for this type of functions");
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:9,代码来源:RObjectInterceptor.java

示例12: intercept

import net.bytebuddy.implementation.bind.annotation.AllArguments; //导入依赖的package包/类
@RuntimeType
public static Object intercept(
        @Origin Method method,
        @AllArguments Object[] args,
        @This Object me,
        @FieldValue("liveObjectLiveMap") RMap<?, ?> map
) throws Exception {
    if (args.length >= 1 && String.class.isAssignableFrom(args[0].getClass())) {
        String name = ((String) args[0]).substring(0, 1).toUpperCase() + ((String) args[0]).substring(1);
        if ("get".equals(method.getName()) && args.length == 1) {
            try {
                return me.getClass().getMethod("get" + name).invoke(me);
            } catch (NoSuchMethodException noSuchMethodException) {
                throw new NoSuchFieldException((String) args[0]);
            }
        } else if ("set".equals(method.getName()) && args.length == 2) {
            Method m = ClassUtils.searchForMethod(me.getClass(), "set" + name, new Class[]{args[1].getClass()});
            if (m != null) {
                return m.invoke(me, args[1]);
            } else {
                throw new NoSuchFieldException((String) args[0]);
            }
        }
    }
    throw new NoSuchMethodException(method.getName() + " called with wrong signature");

}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:28,代码来源:FieldAccessorInterceptor.java

示例13: intercept

import net.bytebuddy.implementation.bind.annotation.AllArguments; //导入依赖的package包/类
@RuntimeType
public static Object intercept(
        @Origin Method method,
        @AllArguments Object[] args,
        @FieldValue("liveObjectLiveMap") RMap<?, ?> map
) throws Exception {
    Class<?>[] cls = new Class[args.length];
    for (int i = 0; i < args.length; i++) {
        cls[i] = args[i].getClass();
    }
    return ClassUtils.searchForMethod(RExpirable.class, method.getName(), cls).invoke(map, args);
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:13,代码来源:RExpirableInterceptor.java

示例14: intercept

import net.bytebuddy.implementation.bind.annotation.AllArguments; //导入依赖的package包/类
@RuntimeType
public Object intercept(@AllArguments Object[] allArguments,
                        @Origin Method method) {
    // intercept any method of any signature
    Class<?> returnType = method.getReturnType();
    if (returnType == String.class) return "bingoo";
    else if (returnType == int.class) return 2048;
    return null;
}
 
开发者ID:bingoohuang,项目名称:javacode-demo,代码行数:10,代码来源:GeneralInterceptor.java

示例15: intercept

import net.bytebuddy.implementation.bind.annotation.AllArguments; //导入依赖的package包/类
@RuntimeType
public void intercept(@This Object obj, @FieldProxy(ClassEnhancePluginDefine.contextAttrName) FieldSetter accessor,
		@AllArguments Object[] allArguments) {
	try {
		EnhancedClassInstanceContext context = new EnhancedClassInstanceContext();
		accessor.setValue(context);
		ConstructorInvokeContext interceptorContext = new ConstructorInvokeContext(obj, allArguments);
		interceptor.onConstruct(context, interceptorContext);
	} catch (Throwable t) {
		logger.error("ClassConstructorInterceptor failue.", t);
	}

}
 
开发者ID:O2O-Market,项目名称:Market-monitor,代码行数:14,代码来源:ClassConstructorInterceptor.java


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