Class FieldDescription.AbstractBase

    • Constructor Detail

      • AbstractBase

        public AbstractBase()
    • Method Detail

      • getInternalName

        public java.lang.String getInternalName()
        Returns the internal name of this byte code element. If no well-defined internal name is known for this element, the actual name is returned.
        Specified by:
        getInternalName in interface NamedElement.WithRuntimeName
        Returns:
        The internal name of this byte code element as used within the Java class file format.
      • getActualName

        public java.lang.String getActualName()
        Returns the display name of this element as it is found in the source code. If no such name exists, an empty string is returned.
        Specified by:
        getActualName in interface NamedElement
        Returns:
        The name of this element as given in a Java program's source code.
      • getDescriptor

        public java.lang.String getDescriptor()
        Returns the descriptor of this byte code element.
        Specified by:
        getDescriptor in interface NamedElement.WithDescriptor
        Returns:
        The descriptor of this byte code element.
      • getGenericSignature

        public java.lang.String getGenericSignature()
        Returns the generic signature of this byte code element. If this element does not reference generic types or references malformed generic types, null is returned as a signature.
        Specified by:
        getGenericSignature in interface NamedElement.WithDescriptor
        Returns:
        The generic signature or null if this element is not generic.
      • isVisibleTo

        public boolean isVisibleTo​(TypeDescription typeDescription)

        Checks if this element is visible from a given type. Visibility is a wider criteria then accessibility which can be checked by ByteCodeElement.isAccessibleTo(TypeDescription). Visibility allows the invocation of a method on itself or on external instances.

        Note: A method or field might define a signature that includes types that are not visible to a type. Such methods can be legally invoked from this type and can even be implemented as bridge methods by this type. It is however not legal to declare a method with invisible types in its signature that are not bridges what might require additional validation.

        Important: Virtual byte code elements, i.e. virtual methods, are only considered visible if the type they are invoked upon is visible to a given type. The visibility of such virtual members can therefore not be determined by only investigating the invoked method but requires an additional check of the target type.

        Specified by:
        isVisibleTo in interface ByteCodeElement
        Parameters:
        typeDescription - The type which is checked for its visibility of this element.
        Returns:
        true if this element is visible for typeDescription.
      • isAccessibleTo

        public boolean isAccessibleTo​(TypeDescription typeDescription)

        Checks if this element is accessible from a given type. Accessibility is a more narrow criteria then visibility which can be checked by ByteCodeElement.isVisibleTo(TypeDescription). Accessibility allows the invocation of a method on external instances or on itself. Methods that can be invoked from within an instance might however not be considered accessible.

        Note: A method or field might define a signature that includes types that are not visible to a type. Such methods can be legally invoked from this type and can even be implemented as bridge methods by this type. It is however not legal to declare a method with invisible types in its signature that are not bridges what might require additional validation.

        Important: Virtual byte code elements, i.e. virtual methods, are only considered visible if the type they are invoked upon is visible to a given type. The visibility of such virtual members can therefore not be determined by only investigating the invoked method but requires an additional check of the target type.

        Specified by:
        isAccessibleTo in interface ByteCodeElement
        Parameters:
        typeDescription - The type which is checked for its accessibility of this element.
        Returns:
        true if this element is accessible for typeDescription.
      • getActualModifiers

        public int getActualModifiers()
        Returns the field's actual modifiers as it is present in a class file, i.e. its modifiers including a flag if this field is deprecated.
        Specified by:
        getActualModifiers in interface FieldDescription
        Returns:
        The field's actual modifiers.
      • hashCode

        @Enhance("hashCode")
        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • toGenericString

        public java.lang.String toGenericString()
        Returns a generic string of this byte code element.
        Specified by:
        toGenericString in interface NamedElement.WithGenericName
        Returns:
        A generic string of this byte code element.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object