本文整理汇总了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);
}
}
示例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;
}
示例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);
}
}
示例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 );
}
示例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 );
}
示例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 );
}
示例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());
}
示例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.");
}
示例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());
}
示例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);
}
示例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");
}
示例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");
}
示例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);
}
示例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;
}
示例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);
}
}