/** * Transforms this list of nodes into a list of the node's representatives. * * @return A list of these node's representatives. */ public MethodList<?> asMethodList() { List<MethodDescription> methodDescriptions = new ArrayList<MethodDescription>(size()); for (Node node : nodes) { methodDescriptions.add(node.getRepresentative()); } return new MethodList.Explicit<MethodDescription>(methodDescriptions); } }
/** * {@inheritDoc} */ public MethodList<?> getInstrumentedMethods() { return new MethodList.Explicit<MethodDescription>(new ArrayList<MethodDescription>(implementations.keySet())).filter(not(isTypeInitializer())); }
: instrumentedType, methodGraph, new MethodList.Explicit<MethodDescription>(methods));
classFileVersion, auxiliaryTypes, new MethodList.Explicit<MethodDescription>(methods), typeAttributeAppender, asmVisitorWrapper,
/** * {@inheritDoc} */ public Compiled compile(TypeDescription instrumentedType) { MethodList<?> targets = new MethodList.Explicit<MethodDescription>(CompoundList.<MethodDescription>of( instrumentedType.getDeclaredMethods().filter(isStatic().or(isPrivate())), methodGraphCompiler.compile(instrumentedType).listNodes().asMethodList()) ).filter(named(name).and(takesArguments(0)).and(not(returns(isPrimitive().or(isArray()))))); if (targets.size() != 1) { throw new IllegalStateException(instrumentedType + " does not define method without arguments with name " + name + ": " + targets); } else if (!targets.getOnly().getReturnType().asErasure().isVisibleTo(instrumentedType)) { throw new IllegalStateException(targets.getOnly() + " is not visible to " + instrumentedType); } else { MethodList<?> candidates = methodGraphCompiler.compile(targets.getOnly().getReturnType(), instrumentedType) .listNodes() .asMethodList() .filter(matcher); List<MethodDelegationBinder.Record> records = new ArrayList<MethodDelegationBinder.Record>(candidates.size()); MethodDelegationBinder methodDelegationBinder = TargetMethodAnnotationDrivenBinder.of(parameterBinders); for (MethodDescription candidate : candidates) { records.add(methodDelegationBinder.compile(candidate)); } return new Compiled.ForMethodReturn(targets.get(0), records); } }
@Override protected MethodList<S> wrap(List<S> values) { return new Explicit<S>(values); }
/** * {@inheritDoc} */ public MethodList<MethodDescription.InDefinedShape> asDefined() { List<MethodDescription.InDefinedShape> declaredForms = new ArrayList<MethodDescription.InDefinedShape>(size()); for (MethodDescription methodDescription : this) { declaredForms.add(methodDescription.asDefined()); } return new Explicit<MethodDescription.InDefinedShape>(declaredForms); } }
/** * {@inheritDoc} */ public MethodList<?> getInstrumentedMethods() { return new MethodList.Explicit<MethodDescription>(new ArrayList<MethodDescription>(implementations.keySet())).filter(not(isTypeInitializer())); }