Class ConstantPool.MethodHandle

    • Field Summary

       
      Instance-Fields: Table-Index & Reference-Kind
      Modifier and Type Field Description
      byte kind
      Contains a Java byte.
      int tableIndex
      The Constant-Pool Table-Index where this Method-Handle is located
       
      Instance-Fields: Data about the Method-Reference to which this Handle Points
      Modifier and Type Field Description
      int referencedIndex
      Points to a Constant in the Constant-Pool Table.
      String referencedName
      The name of the method or field to which this reference points, as a String
      byte referencedTagKind
      This contains the actual Tag-Kind (as a Java byte) of the Reference to which this handle points.
       
      Static-Fields: Constants for all Nine Method-Handle 'Kinds'
      Modifier and Type Field Description
      static byte KIND_GET_FIELD
      Reference-Kind value for getField.
      static byte KIND_GET_STATIC
      Reference-Kind value for getStatic.
      static byte KIND_INVOKE_INTERFACE
      Reference-Kind value for invokeInterface.
      static byte KIND_INVOKE_SPECIAL
      Reference-Kind value for invokeSpecial.
      static byte KIND_INVOKE_STATIC
      Reference-Kind value for invokeStatic.
      static byte KIND_INVOKE_VIRTUAL
      Reference-Kind value for invokeVirtual.
      static byte KIND_NEW_INVOKE_SPECIAL
      Reference-Kind value for newInvokeSpecial.
      static byte KIND_PUT_FIELD
      Reference-Kind value for putField.
      static byte KIND_PUT_STATIC
      Reference-Kind value for putStatic.
       
      Static-Fields: Maps 'Kinds' from a 'byte' to a String
      Modifier and Type Field Description
      static ReadOnlyList<String> handleKindNames
      This list is contains exactly 9 non-null entries.
    • Method Summary

       
      Methods: class java.lang.Object
      Modifier and Type Method Description
      boolean equals​(Object other)
      Checks for Object-equality between 'this' instance and 'other'.
      int hashCode()
      Generates a hash-code.
      String toString()
      Generate a human readable String.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • equals

        🡅  🡇     🗕  🗗  🗖
        public boolean equals​(java.lang.Object other)
        Checks for Object-equality between 'this' instance and 'other'.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        other - This may be any Java-Object, but only an instance of ConstantPool.MethodHandle will permit this method to return TRUE.
        Returns:
        TRUE if-and-only-if parameter 'other' is an instance of MethodHandle and has identical field values.
        Code:
        Exact Method Body:
         if (! (other instanceof MethodHandle)) return false;
        
         final MethodHandle o = (MethodHandle) other;
        
         return
                 (this.tableIndex == o.tableIndex)
             &&  (this.kind == o.kind)
             &&  (this.referencedIndex == o.referencedIndex)
             &&  (this.referencedTagKind == o.referencedTagKind)
             &&  Objects.equals(this.referencedName, o.referencedName);
        
      • hashCode

        🡅  🡇     🗕  🗗  🗖
        public int hashCode()
        Generates a hash-code. Fulfills Java's Hash-Code reuirement.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a good attempt at an efficient, but fair hashcode.
        Code:
        Exact Method Body:
         return this.tableIndex + this.kind + this.referencedIndex;
        
      • toString

        🡅     🗕  🗗  🗖
        public java.lang.String toString()
        Generate a human readable String.
        Overrides:
        toString in class java.lang.Object
        Returns:
        'this' instance as a Java String
        Code:
        Exact Method Body:
         return
             "Method Handle:\n" +
             "{\n" +
             "    Handle's Table-Index:               " + this.tableIndex + '\n' +
             "    Referenced Item's Name:             " + this.referencedName + '\n' +
             "    Handle Kind:                        " + this.kind + '\n' +
        
             "    Handle Kind's Name:                 " +
                 MethodHandle.handleKindNames.get(this.kind) + '\n' +
        
             "    Referenced Item's Table-Index:      " + this.referencedIndex + '\n' +
             "    Referenced Item's Kind (as byte):   " + this.referencedTagKind + '\n' +
        
             "    Referenced Item's Kind (as String): " +
                 ConstantPool.tagNames.get(this.referencedTagKind) + '\n' +
             "}";