Java Code Examples for net.bytebuddy.dynamic.scaffold.MethodGraph#Node
The following examples show how to use
net.bytebuddy.dynamic.scaffold.MethodGraph#Node .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MethodCallProxy.java From byte-buddy with Apache License 2.0 | 5 votes |
/** * Creates the precomputed method graph. */ @SuppressFBWarnings(value = "SE_BAD_FIELD_STORE", justification = "Precomputed method graph is not intended for serialization") PrecomputedMethodGraph() { LinkedHashMap<MethodDescription.SignatureToken, MethodGraph.Node> nodes = new LinkedHashMap<MethodDescription.SignatureToken, MethodGraph.Node>(); MethodDescription callMethod = new MethodDescription.Latent(TypeDescription.ForLoadedType.of(Callable.class), "call", Opcodes.ACC_PUBLIC | Opcodes.ACC_ABSTRACT, Collections.<TypeVariableToken>emptyList(), TypeDescription.Generic.OBJECT, Collections.<ParameterDescription.Token>emptyList(), Collections.singletonList(TypeDescription.Generic.OfNonGenericType.ForLoadedType.of(Exception.class)), Collections.<AnnotationDescription>emptyList(), AnnotationValue.UNDEFINED, TypeDescription.Generic.UNDEFINED); nodes.put(callMethod.asSignatureToken(), new MethodGraph.Node.Simple(callMethod)); MethodDescription runMethod = new MethodDescription.Latent(TypeDescription.ForLoadedType.of(Runnable.class), "run", Opcodes.ACC_PUBLIC | Opcodes.ACC_ABSTRACT, Collections.<TypeVariableToken>emptyList(), TypeDescription.Generic.VOID, Collections.<ParameterDescription.Token>emptyList(), Collections.<TypeDescription.Generic>emptyList(), Collections.<AnnotationDescription>emptyList(), AnnotationValue.UNDEFINED, TypeDescription.Generic.UNDEFINED); nodes.put(runMethod.asSignatureToken(), new MethodGraph.Node.Simple(runMethod)); MethodGraph methodGraph = new MethodGraph.Simple(nodes); this.methodGraph = new MethodGraph.Linked.Delegation(methodGraph, methodGraph, Collections.<TypeDescription, MethodGraph>emptyMap()); }
Example 2
Source File: SubclassImplementationTarget.java From byte-buddy with Apache License 2.0 | 5 votes |
/** * Resolves a special method invocation for a non-constructor invocation. * * @param token A token describing the method to be invoked. * @return A special method invocation for a method representing the given method token, if available. */ private Implementation.SpecialMethodInvocation invokeMethod(MethodDescription.SignatureToken token) { MethodGraph.Node methodNode = methodGraph.getSuperClassGraph().locate(token); return methodNode.getSort().isUnique() ? Implementation.SpecialMethodInvocation.Simple.of(methodNode.getRepresentative(), instrumentedType.getSuperClass().asErasure()) : Implementation.SpecialMethodInvocation.Illegal.INSTANCE; }
Example 3
Source File: Implementation.java From byte-buddy with Apache License 2.0 | 4 votes |
@Override protected SpecialMethodInvocation apply(MethodGraph.Node node, TypeDescription targetType) { return node.getSort().isUnique() ? SpecialMethodInvocation.Simple.of(node.getRepresentative(), targetType) : SpecialMethodInvocation.Illegal.INSTANCE; }
Example 4
Source File: Implementation.java From byte-buddy with Apache License 2.0 | 2 votes |
@Override protected SpecialMethodInvocation apply(MethodGraph.Node node, TypeDescription targetType) { return SpecialMethodInvocation.Illegal.INSTANCE; }
Example 5
Source File: Implementation.java From byte-buddy with Apache License 2.0 | 2 votes |
/** * Resolves a default method invocation for a given node. * * @param node The node representing the default method call. * @param targetType The target type defining the default method. * @return A suitable special method invocation. */ protected abstract SpecialMethodInvocation apply(MethodGraph.Node node, TypeDescription targetType);
Example 6
Source File: RebaseImplementationTarget.java From byte-buddy with Apache License 2.0 | 2 votes |
/** * Creates a special method invocation for the given node. * * @param node The node for which a special method invocation is to be created. * @return A special method invocation for the provided node. */ private Implementation.SpecialMethodInvocation invokeSuper(MethodGraph.Node node) { return node.getSort().isResolved() ? Implementation.SpecialMethodInvocation.Simple.of(node.getRepresentative(), instrumentedType.getSuperClass().asErasure()) : Implementation.SpecialMethodInvocation.Illegal.INSTANCE; }