Class InternalTypeEnumeration

  • All Implemented Interfaces:
    java.util.Iterator<java.lang.String>

    public class InternalTypeEnumeration
    extends java.lang.Object
    implements java.util.Iterator<java.lang.String>
    An InternalTypeEnumeration provides an enumeration of all types listed in a given internal descriptor or signature of a class, a method, or a field.

    The leading formal type parameters, if any, can be retrieved separately.

    The return type of a method descriptor can also be retrieved separately.

    • Constructor Summary

      Constructors 
      Constructor Description
      InternalTypeEnumeration​(java.lang.String descriptor)
      Creates a new InternalTypeEnumeration for the given method descriptor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String formalTypeParameters()
      Returns the leading formal type parameters from the descriptor.
      boolean hasFormalTypeParameters()
      Returns whether the descriptor has leading formal type parameters.
      boolean hasMoreTypes()
      Returns whether the enumeration can provide more types from the method descriptor.
      boolean hasNext()  
      boolean isMethodSignature()
      Returns whether the descriptor is a method signature.
      static void main​(java.lang.String[] args)
      A main method for testing the type enumeration.
      java.lang.String next()  
      java.lang.String nextType()
      Returns the next type from the method descriptor.
      java.lang.String returnType()
      Returns the return type from the descriptor, assuming it's a method descriptor.
      int typeCount()
      Returns the number of types contained in the descriptor.
      int typesSize()
      Returns the total size of the types contained in the descriptor.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, remove
    • Constructor Detail

      • InternalTypeEnumeration

        public InternalTypeEnumeration​(java.lang.String descriptor)
        Creates a new InternalTypeEnumeration for the given method descriptor.
    • Method Detail

      • typeCount

        public int typeCount()
        Returns the number of types contained in the descriptor. This is the number of types that the enumeration will return.
      • typesSize

        public int typesSize()
        Returns the total size of the types contained in the descriptor. This accounts for long and double parameters taking up two entries.
      • hasFormalTypeParameters

        public boolean hasFormalTypeParameters()
        Returns whether the descriptor has leading formal type parameters.
      • formalTypeParameters

        public java.lang.String formalTypeParameters()
        Returns the leading formal type parameters from the descriptor.
      • isMethodSignature

        public boolean isMethodSignature()
        Returns whether the descriptor is a method signature.
      • hasMoreTypes

        public boolean hasMoreTypes()
        Returns whether the enumeration can provide more types from the method descriptor.
      • nextType

        public java.lang.String nextType()
        Returns the next type from the method descriptor.
      • returnType

        public java.lang.String returnType()
        Returns the return type from the descriptor, assuming it's a method descriptor.
      • main

        public static void main​(java.lang.String[] args)
        A main method for testing the type enumeration.
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<java.lang.String>
      • next

        public java.lang.String next()
        Specified by:
        next in interface java.util.Iterator<java.lang.String>