/** * Creates an instance of a * {@link StackManipulation.Size} * that describes a stack decrease of this size. * * @return A stack size decrease by the size represented by this stack size. */ public StackManipulation.Size toDecreasingSize() { return new StackManipulation.Size(-1 * getSize(), 0); }
/** * {@inheritDoc} */ public StackManipulation prepare(MethodDescription instrumentedMethod) { return new StackManipulation.Compound(TypeCreation.of(typeDescription), Duplication.SINGLE); }
/** * {@inheritDoc} */ public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext) { Size size = new Size(0, 0); for (StackManipulation stackManipulation : stackManipulations) { size = size.aggregate(stackManipulation.apply(methodVisitor, implementationContext)); } return size; } }
/** * {@inheritDoc} */ public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext, MethodDescription instrumentedMethod) { return new Size(stackManipulation.apply(methodVisitor, implementationContext).getMaximalSize(), instrumentedMethod.getStackSize()); } }
/** * {@inheritDoc} */ public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext) { return stackManipulation.apply(methodVisitor, implementationContext); } }
/** * Creates a new simple byte code appender which represents the given stack manipulation. * * @param stackManipulations The stack manipulations to apply for this byte code appender in their application order. */ public Simple(List<? extends StackManipulation> stackManipulations) { this.stackManipulation = new StackManipulation.Compound(stackManipulations); }
/** * {@inheritDoc} */ public int getRequiredVariablePadding() { return StackSize.ZERO.getSize(); } }
/** * Concatenates this size representation with another size representation in order to represent the size * change that is represented by both alterations of the operand stack size. * * @param other The other size representation. * @return A new size representation representing both stack size requirements. */ public Size aggregate(Size other) { return aggregate(other.sizeImpact, other.maximalSize); }
/** * Creates a new simple implementation for the given byte code appenders. * * @param byteCodeAppender The byte code appenders to apply in their order of application. */ public Simple(ByteCodeAppender... byteCodeAppender) { this.byteCodeAppender = new ByteCodeAppender.Compound(byteCodeAppender); }
/** * {@inheritDoc} */ public ByteCodeAppender.Size applyCode(MethodVisitor methodVisitor, Implementation.Context implementationContext) { return byteCodeAppender.apply(methodVisitor, implementationContext, methodDescription); }
/** * {@inheritDoc} */ public boolean isValid() { return stackManipulation.isValid(); }
/** * Creates a new simple instrumentation for the given stack manipulations which are summarized in a * byte code appender that defines any requested method by these manipulations. * * @param stackManipulation The stack manipulation to apply in their order of application. */ public Simple(StackManipulation... stackManipulation) { byteCodeAppender = new ByteCodeAppender.Simple(stackManipulation); }
/** * {@inheritDoc} */ public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext) { return delegate.apply(methodVisitor, implementationContext); } }
/** * {@inheritDoc} */ public boolean isValid() { return fieldConstant.isValid(); }
/** * {@inheritDoc} */ public boolean isValid() { return implementation.isValid(); }
/** * Creates an instance of a * {@link StackManipulation.Size} * that describes a stack growth of this size. * * @return A stack size growth by the size represented by this stack size. */ public StackManipulation.Size toIncreasingSize() { return new StackManipulation.Size(getSize(), getSize()); }
/** * {@inheritDoc} */ public boolean isValid() { return methodName.isValid(); }
/** * {@inheritDoc} */ public boolean isValid() { return constructorConstant.isValid(); }