Class MethodAttributeAppender.Explicit

    • Constructor Detail

      • Explicit

        public Explicit​(int parameterIndex,
                        java.util.List<? extends AnnotationDescription> annotations)
        Creates a new appender for appending an annotation to a method.
        Parameters:
        parameterIndex - The index of the parameter to which the annotations should be written.
        annotations - The annotations that should be written.
      • Explicit

        public Explicit​(java.util.List<? extends AnnotationDescription> annotations)
        Creates a new appender for appending an annotation to a method.
        Parameters:
        annotations - The annotations that should be written.
      • Explicit

        protected Explicit​(MethodAttributeAppender.Explicit.Target target,
                           java.util.List<? extends AnnotationDescription> annotations)
        Creates an explicit annotation appender for a either a method or one of its parameters..
        Parameters:
        target - The target to which the annotation should be written to.
        annotations - The annotations to write.
    • Method Detail

      • of

        public static MethodAttributeAppender.Factory of​(MethodDescription methodDescription)
        Creates a method attribute appender factory that writes all annotations of a given method, both the method annotations themselves and all annotations that are defined for every parameter.
        Parameters:
        methodDescription - The method from which to extract the annotations.
        Returns:
        A method attribute appender factory for an appender that writes all annotations of the supplied method.
      • ofMethodAnnotations

        public static MethodAttributeAppender.Factory ofMethodAnnotations​(MethodDescription methodDescription)
        Creates a method attribute appender factory that writes all method annotations that are defined on the given method.
        Parameters:
        methodDescription - The method from which to extract the method annotations.
        Returns:
        A method attribute appender factory for an appender that writes all method annotations of the supplied method.
      • ofParameterAnnotations

        public static MethodAttributeAppender.Factory ofParameterAnnotations​(MethodDescription methodDescription)
        Creates a method attribute appender factory that writes all annotations that are defined for every parameter of the given method.
        Parameters:
        methodDescription - The method from which to extract the parameter annotations.
        Returns:
        A method attribute appender factory for an appender that writes all parameter annotations of the supplied method.
      • make

        public MethodAttributeAppender make​(TypeDescription typeDescription)
        Returns a method attribute appender that is applicable for a given type description.
        Specified by:
        make in interface MethodAttributeAppender.Factory
        Parameters:
        typeDescription - The type for which a method attribute appender is to be applied for.
        Returns:
        The method attribute appender which should be applied for the given type.
      • apply

        public void apply​(org.objectweb.asm.MethodVisitor methodVisitor,
                          MethodDescription methodDescription,
                          AnnotationValueFilter annotationValueFilter)
        Applies this attribute appender to a given method visitor.
        Specified by:
        apply in interface MethodAttributeAppender
        Parameters:
        methodVisitor - The method visitor to which the attributes that are represented by this attribute appender are written to.
        methodDescription - The description of the method for which the given method visitor creates an instrumentation for.
        annotationValueFilter - The annotation value filter to apply when the annotations are written.