本文整理了Java中net.bytebuddy.implementation.bind.annotation.This
类的一些代码示例,展示了This
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。This
类的具体详情如下:
包路径:net.bytebuddy.implementation.bind.annotation.This
类名称:This
暂无
代码示例来源:origin: hibernate/hibernate-orm
/**
* Intercepts a method call to a proxy.
*
* @param instance The proxied instance.
* @param method The invoked method.
* @param arguments The intercepted method arguments.
*
* @return The method's return value.
*
* @throws Throwable If the intercepted method raises an exception.
*/
@RuntimeType
Object intercept(@This Object instance, @Origin Method method, @AllArguments Object[] arguments) throws Throwable;
}
代码示例来源:origin: redisson/redisson
/**
* {@inheritDoc}
*/
public MethodDelegationBinder.ParameterBinding<?> bind(AnnotationDescription.Loadable<This> annotation,
MethodDescription source,
ParameterDescription target,
Implementation.Target implementationTarget,
Assigner assigner,
Assigner.Typing typing) {
if (target.getType().isPrimitive()) {
throw new IllegalStateException(target + " uses a primitive type with a @This annotation");
} else if (target.getType().isArray()) {
throw new IllegalStateException(target + " uses an array type with a @This annotation");
} else if (source.isStatic() && !annotation.loadSilent().optional()) {
return MethodDelegationBinder.ParameterBinding.Illegal.INSTANCE;
}
return new MethodDelegationBinder.ParameterBinding.Anonymous(source.isStatic()
? NullConstant.INSTANCE
: new StackManipulation.Compound(MethodVariableAccess.loadThis(),
assigner.assign(implementationTarget.getInstrumentedType().asGenericType(), target.getType(), typing)));
}
}
代码示例来源:origin: com.syncleus.ferma/ferma
@RuntimeType
public static Set 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.");
}
}).toSet(VertexFrame.class);
}
}
代码示例来源:origin: com.syncleus.ferma/ferma
@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.");
}
}
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework
@RuntimeType
public ContextProperty getter(@Origin Method method, @This ViewContextBase that) {
return that.properties().get(method.getName());
}
}
代码示例来源:origin: org.jboss.windup.graph/windup-graph-impl
public static void removeProperty(@This final ElementFrame thiz, @Origin final Method method)
{
assert thiz instanceof CachesReflection;
final Property annotation = ((CachesReflection) thiz).getReflectionCache().getAnnotation(method, Property.class);
final String propertyName = annotation.value();
Element element = thiz.getElement();
if (element instanceof Vertex)
thiz.getGraph().getRawTraversal().V(element.id()).properties(propertyName).drop().iterate();
else
thiz.getGraph().getRawTraversal().E(element.id()).properties(propertyName).drop().iterate();
thiz.getElement().property(propertyName).remove();
}
}
代码示例来源:origin: org.assertj/assertj-core
@RuntimeType
public static Object intercept(@This AbstractAssert<?, ?> assertion, @SuperCall Callable<Object> proxy) throws Exception {
try {
Object result = proxy.call();
if (result != assertion && result instanceof AbstractAssert) {
return asAssumption((AbstractAssert<?, ?>) result).withAssertionState(assertion);
}
return result;
} catch (AssertionError e) {
throw assumptionNotMet(e);
}
}
}
代码示例来源:origin: cz.etnetera/seb
public static void intercept(@This SebElement element, @Origin(cache = true) Method method,
@AllArguments Object[] arguments) throws Exception {
if (!method.isAnnotationPresent(DisableLazyInit.class)) {
element.init();
}
}
代码示例来源:origin: com.syncleus.ferma/ferma
public static void removeProperty(@This final ElementFrame thiz, @Origin final Method method) {
assert thiz instanceof CachesReflection;
final Property annotation = ((CachesReflection) thiz).getReflectionCache().getAnnotation(method, Property.class);
final String value = annotation.value();
thiz.getElement().property(value).remove();
}
}
代码示例来源:origin: org.mockito/mockito-core
@SuppressWarnings("unused")
public static int doIdentityHashCode(@This Object thiz) {
return System.identityHashCode(thiz);
}
}
代码示例来源:origin: com.syncleus.ferma/ferma
@RuntimeType
public static Object 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.");
}
}).nextOrDefault(VertexFrame.class, null);
}
}
代码示例来源:origin: com.syncleus.ferma/ferma
@RuntimeType
public static Set 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)).toSet(VertexFrame.class);
case IN:
return thiz.traverse(input -> input.inE(label)).toSet(VertexFrame.class);
case OUT:
return thiz.traverse(input -> input.outE(label)).toSet(VertexFrame.class);
default:
throw new IllegalStateException(method.getName() + " is annotated with a direction other than BOTH, IN, or OUT.");
}
}
}
代码示例来源:origin: com.syncleus.ferma/ferma
@RuntimeType
public static Object getVertex(@This final EdgeFrame thiz, @Origin final Method method) {
return thiz.traverse(GraphTraversal::inV).next(method.getReturnType());
}
}
代码示例来源:origin: windup/windup
public static void removeProperty(@This final ElementFrame thiz, @Origin final Method method)
{
assert thiz instanceof CachesReflection;
final Property annotation = ((CachesReflection) thiz).getReflectionCache().getAnnotation(method, Property.class);
final String propertyName = annotation.value();
Element element = thiz.getElement();
if (element instanceof Vertex)
thiz.getGraph().getRawTraversal().V(element.id()).properties(propertyName).drop().iterate();
else
thiz.getGraph().getRawTraversal().E(element.id()).properties(propertyName).drop().iterate();
thiz.getElement().property(propertyName).remove();
}
}
代码示例来源:origin: joel-costigliola/assertj-core
@RuntimeType
public static Object intercept(@This AbstractAssert<?, ?> assertion, @SuperCall Callable<Object> proxy) throws Exception {
try {
Object result = proxy.call();
if (result != assertion && result instanceof AbstractAssert) {
return asAssumption((AbstractAssert<?, ?>) result).withAssertionState(assertion);
}
return result;
} catch (AssertionError e) {
throw assumptionNotMet(e);
}
}
}
代码示例来源:origin: org.mockito/mockito-core
@SuppressWarnings("unused")
public static boolean doIdentityEquals(@This Object thiz, @Argument(0) Object other) {
return thiz == other;
}
}
代码示例来源:origin: org.jboss.windup.graph/windup-graph-impl
@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);
}
}
代码示例来源:origin: redisson/redisson
@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() + " has wrong signature");
}
}
代码示例来源:origin: Syncleus/Ferma
@RuntimeType
public static Set 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)).toSet(VertexFrame.class);
case IN:
return thiz.traverse(input -> input.inE(label)).toSet(VertexFrame.class);
case OUT:
return thiz.traverse(input -> input.outE(label)).toSet(VertexFrame.class);
default:
throw new IllegalStateException(method.getName() + " is annotated with a direction other than BOTH, IN, or OUT.");
}
}
}
代码示例来源:origin: com.syncleus.ferma/ferma
@RuntimeType
public static void removeEdge(@This final VertexFrame thiz, @Origin final Method method, @RuntimeType @Argument(0) final EdgeFrame edge) {
edge.remove();
}
}
内容来源于网络,如有侵权,请联系作者删除!