本文整理汇总了Java中net.bytebuddy.implementation.bind.annotation.This类的典型用法代码示例。如果您正苦于以下问题:Java This类的具体用法?Java This怎么用?Java This使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
This类属于net.bytebuddy.implementation.bind.annotation包,在下文中一共展示了This类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: intercept
import net.bytebuddy.implementation.bind.annotation.This; //导入依赖的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: intercept
import net.bytebuddy.implementation.bind.annotation.This; //导入依赖的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
示例3: getVertexes
import net.bytebuddy.implementation.bind.annotation.This; //导入依赖的package包/类
@RuntimeType
public static Iterator getVertexes(@This final VertexFrame thiz, @Origin final Method method) {
assert thiz instanceof CachesReflection;
final Adjacency annotation = ((CachesReflection) thiz).getReflectionCache().getAnnotation(method, Adjacency.class);
final Direction direction = annotation.direction();
final String label = annotation.label();
return thiz.traverse(input -> {
switch(direction) {
case IN:
return input.in(label);
case OUT:
return input.out(label);
case BOTH:
return input.both(label);
default:
throw new IllegalStateException("Direction not recognized.");
}
}).frame(VertexFrame.class);
}
开发者ID:Syncleus,项目名称:Ferma,代码行数:21,代码来源:AdjacencyMethodHandler.java
示例4: getVertex
import net.bytebuddy.implementation.bind.annotation.This; //导入依赖的package包/类
@RuntimeType
public static Object getVertex(@This final VertexFrame thiz, @Origin final Method method, @RuntimeType @Argument(0) final Class type) {
assert thiz instanceof CachesReflection;
final Adjacency annotation = ((CachesReflection) thiz).getReflectionCache().getAnnotation(method, Adjacency.class);
final Direction direction = annotation.direction();
final String label = annotation.label();
final TypeResolver resolver = thiz.getGraph().getTypeResolver();
return thiz.traverse(input -> {
switch(direction) {
case IN:
return resolver.hasType(input.in(label), type);
case OUT:
return resolver.hasType(input.out(label), type);
case BOTH:
return resolver.hasType(input.both(label), type);
default:
throw new IllegalStateException("Direction not recognized.");
}
}).next(type);
}
开发者ID:Syncleus,项目名称:Ferma,代码行数:22,代码来源:AdjacencyMethodHandler.java
示例5: addVertex
import net.bytebuddy.implementation.bind.annotation.This; //导入依赖的package包/类
@RuntimeType
public static Object addVertex(@This final VertexFrame thiz, @Origin final Method method) {
final VertexFrame newVertex = thiz.getGraph().addFramedVertex();
assert thiz instanceof CachesReflection;
final Adjacency annotation = ((CachesReflection) thiz).getReflectionCache().getAnnotation(method, Adjacency.class);
final Direction direction = annotation.direction();
final String label = annotation.label();
switch (direction) {
case BOTH:
thiz.getGraph().addFramedEdge(newVertex, thiz, label);
thiz.getGraph().addFramedEdge(thiz, newVertex, label);
break;
case IN:
thiz.getGraph().addFramedEdge(newVertex, thiz, label);
break;
case OUT:
thiz.getGraph().addFramedEdge(thiz, newVertex, label);
break;
default:
throw new IllegalStateException(method.getName() + " is annotated with a direction other than BOTH, IN, or OUT.");
}
return newVertex;
}
开发者ID:Syncleus,项目名称:Ferma,代码行数:26,代码来源:AdjacencyMethodHandler.java
示例6: addEdge
import net.bytebuddy.implementation.bind.annotation.This; //导入依赖的package包/类
@RuntimeType
public static Object addEdge(@This final VertexFrame thiz, @Origin final Method method) {
final VertexFrame newVertex = thiz.getGraph().addFramedVertex();
assert thiz instanceof CachesReflection;
final Incidence annotation = ((CachesReflection) thiz).getReflectionCache().getAnnotation(method, Incidence.class);
final Direction direction = annotation.direction();
final String label = annotation.label();
switch (direction) {
case BOTH:
throw new IllegalStateException(method.getName() + " is annotated with direction BOTH, this is not allowed for add methods annotated with @Incidence.");
case IN:
return thiz.getGraph().addFramedEdge(newVertex, thiz, label);
case OUT:
return thiz.getGraph().addFramedEdge(thiz, newVertex, label);
default:
throw new IllegalStateException(method.getName() + " is annotated with a direction other than BOTH, IN, or OUT.");
}
}
开发者ID:Syncleus,项目名称:Ferma,代码行数:20,代码来源:IncidenceMethodHandler.java
示例7: addVertex
import net.bytebuddy.implementation.bind.annotation.This; //导入依赖的package包/类
@RuntimeType
public static Object addVertex(@This final VertexFrame thiz, @Origin final Method method, @RuntimeType @Argument(value = 0) final ClassInitializer vertexType) {
final Object newNode = thiz.getGraph().addFramedVertex(vertexType);
assert newNode instanceof VertexFrame;
final VertexFrame newVertex = ((VertexFrame) newNode);
assert thiz instanceof CachesReflection;
final Incidence annotation = ((CachesReflection) thiz).getReflectionCache().getAnnotation(method, Incidence.class);
final Direction direction = annotation.direction();
final String label = annotation.label();
assert vertexType.getInitializationType().isInstance(newNode);
switch (direction) {
case BOTH:
throw new IllegalStateException(method.getName() + " is annotated with direction BOTH, this is not allowed for add methods annotated with @Incidence.");
case IN:
return thiz.getGraph().addFramedEdge(newVertex, thiz, label);
case OUT:
return thiz.getGraph().addFramedEdge(thiz, newVertex, label);
default:
throw new IllegalStateException(method.getName() + " is annotated with a direction other than BOTH, IN, or OUT.");
}
}
开发者ID:Syncleus,项目名称:Ferma,代码行数:25,代码来源:IncidenceMethodHandler.java
示例8: getEdges
import net.bytebuddy.implementation.bind.annotation.This; //导入依赖的package包/类
@RuntimeType
public static Iterator getEdges(@This final VertexFrame thiz, @Origin final Method method) {
assert thiz instanceof CachesReflection;
final Incidence annotation = ((CachesReflection) thiz).getReflectionCache().getAnnotation(method, Incidence.class);
final Direction direction = annotation.direction();
final String label = annotation.label();
switch (direction) {
case BOTH:
return thiz.traverse(input -> input.bothE(label)).frame(VertexFrame.class);
case IN:
return thiz.traverse(input -> input.inE(label)).frame(VertexFrame.class);
case OUT:
return thiz.traverse(input -> input.outE(label)).frame(VertexFrame.class);
default:
throw new IllegalStateException(method.getName() + " is annotated with a direction other than BOTH, IN, or OUT.");
}
}
开发者ID:Syncleus,项目名称:Ferma,代码行数:19,代码来源:IncidenceMethodHandler.java
示例9: getEdge
import net.bytebuddy.implementation.bind.annotation.This; //导入依赖的package包/类
@RuntimeType
public static Object getEdge(@This final VertexFrame thiz, @Origin final Method method, @RuntimeType @Argument(0) final Class type) {
assert thiz instanceof CachesReflection;
final Incidence annotation = ((CachesReflection) thiz).getReflectionCache().getAnnotation(method, Incidence.class);
final Direction direction = annotation.direction();
final String label = annotation.label();
final TypeResolver resolver = thiz.getGraph().getTypeResolver();
switch (direction) {
case BOTH:
return thiz.traverse(input -> resolver.hasType(input.bothE(label), type)).next(type);
case IN:
return thiz.traverse(input -> resolver.hasType(input.inE(label), type)).next(type);
case OUT:
return thiz.traverse(input -> resolver.hasType(input.outE(label), type)).next(type);
default:
throw new IllegalStateException(method.getName() + " is annotated with a direction other than BOTH, IN, or OUT.");
}
}
开发者ID:Syncleus,项目名称:Ferma,代码行数:20,代码来源:IncidenceMethodHandler.java
示例10: interceptSuper
import net.bytebuddy.implementation.bind.annotation.This; //导入依赖的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
示例11: interceptDefault
import net.bytebuddy.implementation.bind.annotation.This; //导入依赖的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
示例12: intercept
import net.bytebuddy.implementation.bind.annotation.This; //导入依赖的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
示例13: intercept
import net.bytebuddy.implementation.bind.annotation.This; //导入依赖的package包/类
@RuntimeType
public Object intercept(@This Object obj, @SuperCall Callable<Object> proxy,
@SuperMethod(nullIfImpossible = true) Method method) throws Exception {
try {
Object returnResult = proxy.call();
lastResult.setSuccess(true);
return returnResult;
} catch (AssertionError e) {
if (isNestedErrorCollectorProxyCall()) {
// let the most outer call handle the assertion error
throw e;
}
lastResult.setSuccess(false);
errors.add(e);
}
if (method != null && !method.getReturnType().isInstance(obj)) {
// In case the object is not an instance of the return type, just return null to avoid ClassCastException
// with ByteBuddy
return null;
}
return obj;
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:23,代码来源:ErrorCollector.java
注:本文中的net.bytebuddy.implementation.bind.annotation.This类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论