Enum MemberSubstitution.Source

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<MemberSubstitution.Source>
    Enclosing class:
    MemberSubstitution

    public static enum MemberSubstitution.Source
    extends java.lang.Enum<MemberSubstitution.Source>
    Identifies the source of an instruction that might describe a value of the substituted element or the instrumented method.
    • Enum Constant Detail

      • SUBSTITUTED_ELEMENT

        public static final MemberSubstitution.Source SUBSTITUTED_ELEMENT
        Indicates that an element should be loaded in context of the substituted method, constructor or field.
      • ENCLOSING_METHOD

        public static final MemberSubstitution.Source ENCLOSING_METHOD
        Indicates that an element should be loaded in context of the instrumented method.
    • Constructor Detail

      • Source

        private Source()
    • Method Detail

      • values

        public static MemberSubstitution.Source[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (MemberSubstitution.Source c : MemberSubstitution.Source.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static MemberSubstitution.Source valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • element

        protected abstract ByteCodeElement.Member element​(ByteCodeElement.Member original,
                                                          MethodDescription instrumentedMethod)
        Resolves the targeted byte code element.
        Parameters:
        original - The substituted element.
        instrumentedMethod - The instrumented element.
        Returns:
        The byte code element that is represented by this source.
      • self

        @MaybeNull
        protected abstract MemberSubstitution.Source.Value self​(TypeList.Generic parameters,
                                                                java.util.Map<java.lang.Integer,​java.lang.Integer> offsets,
                                                                ByteCodeElement.Member original,
                                                                MethodDescription instrumentedMethod)
        Resolves a value representation of the this reference or null if no such reference is available.
        Parameters:
        parameters - The list of parameters of the substituted element.
        offsets - A mapping of offsets of parameter indices to offsets.
        original - The substituted element.
        instrumentedMethod - The instrumented method.
        Returns:
        A representation of the this reference or null if no such reference is available.
      • argument

        @MaybeNull
        protected abstract MemberSubstitution.Source.Value argument​(int index,
                                                                    TypeList.Generic parameters,
                                                                    java.util.Map<java.lang.Integer,​java.lang.Integer> offsets,
                                                                    ByteCodeElement.Member original,
                                                                    MethodDescription instrumentedMethod)
        Resolves a value representation of the parameter of the specified index or null if no such parameter is available.
        Parameters:
        index - The index of the targeted parameter.
        parameters - The list of parameters of the substituted element.
        offsets - A mapping of offsets of parameter indices to offsets.
        original - The substituted element.
        instrumentedMethod - The instrumented method.
        Returns:
        A representation of the parameter of the specified index or null if no such parameter is available.
      • arguments

        protected abstract java.util.List<MemberSubstitution.Source.Value> arguments​(boolean includesSelf,
                                                                                     TypeList.Generic parameters,
                                                                                     java.util.Map<java.lang.Integer,​java.lang.Integer> offsets,
                                                                                     ByteCodeElement.Member original,
                                                                                     MethodDescription instrumentedMethod)
        Resolves a list of value representation of all parameters.
        Parameters:
        includesSelf - true if the this reference should be included if available.
        parameters - The list of parameters of the substituted element.
        offsets - A mapping of offsets of parameter indices to offsets.
        original - The substituted element.
        instrumentedMethod - The instrumented method.
        Returns:
        A list of representation of all values of all parameters.