Class GenericObjectType

  • All Implemented Interfaces:
    java.io.Serializable

    public class GenericObjectType
    extends org.apache.bcel.generic.ObjectType
    Extension to ObjectType that includes additional information about the generic signature.

    A GenericObjectType is either a parameterized type e.g. List<String>, or a type variable e.g. T.

    This class cannot be initialized directly. Instead, create a GenericObjectType by calling GenericUtilities.getType(String) and passing in the bytecode signature for the type.

    Author:
    Nat Ayewah
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class org.apache.bcel.generic.Type

        BOOLEAN, BYTE, CHAR, CLASS, DOUBLE, FLOAT, INT, LONG, NO_ARGS, NULL, OBJECT, SHORT, signature, STRING, STRINGBUFFER, THROWABLE, type, UNKNOWN, VOID
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      org.apache.bcel.generic.Type getExtension()  
      java.lang.String getGenericParametersAsString()  
      int getNumParameters()  
      org.apache.bcel.generic.ObjectType getObjectType()  
      org.apache.bcel.generic.ReferenceType getParameterAt​(int index)  
      java.util.List<? extends org.apache.bcel.generic.ReferenceType> getParameters()  
      GenericUtilities.TypeCategory getTypeCategory()
      Get the TypeCategory that represents this Object
      org.apache.bcel.generic.Type getUpperBound()  
      java.lang.String getVariable()  
      int hashCode()  
      boolean hasParameters()  
      org.apache.bcel.generic.ReferenceType produce()  
      java.lang.String toPlainString()  
      java.lang.String toString()  
      java.lang.String toString​(boolean includeGenerics)
      Return a string representation of this object.
      • Methods inherited from class org.apache.bcel.generic.ObjectType

        accessibleTo, getClassName, getInstance, referencesClass, referencesClassExact, referencesInterface, referencesInterfaceExact, subclassOf
      • Methods inherited from class org.apache.bcel.generic.ReferenceType

        firstCommonSuperclass, getFirstCommonSuperclass, isAssignmentCompatibleWith, isCastableTo
      • Methods inherited from class org.apache.bcel.generic.Type

        getArgumentTypes, getMethodSignature, getReturnType, getSignature, getSignature, getSize, getType, getType, getType, getTypes
      • Methods inherited from class java.lang.Object

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

      • produce

        public org.apache.bcel.generic.ReferenceType produce()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class org.apache.bcel.generic.ObjectType
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class org.apache.bcel.generic.ObjectType
      • getUpperBound

        public org.apache.bcel.generic.Type getUpperBound()
      • getExtension

        public org.apache.bcel.generic.Type getExtension()
        Returns:
        Returns the extension.
      • getVariable

        public java.lang.String getVariable()
        Returns:
        Returns the variable.
      • hasParameters

        public boolean hasParameters()
        Returns:
        true if this GenericObjectType represents a parameterized type e.g. List<String>. This implies that isVariable() is falses
      • getNumParameters

        public int getNumParameters()
        Returns:
        the number of parameters if this is a parameterized class, 0 otherwise
      • getParameterAt

        public org.apache.bcel.generic.ReferenceType getParameterAt​(int index)
        Parameters:
        index - should be less than getNumParameters()
        Returns:
        the type parameter at index
      • getParameters

        @CheckForNull
        public java.util.List<? extends org.apache.bcel.generic.ReferenceType> getParameters()
      • getObjectType

        public org.apache.bcel.generic.ObjectType getObjectType()
        Returns:
        the underlying ObjectType for this Generic Object
      • toString

        public java.lang.String toString​(boolean includeGenerics)
        Return a string representation of this object. (I do not override toString() in case any existing code assumes that this object is an ObjectType and expects similar string representation. i.e. toString() is equivalent to toString(false))
        Parameters:
        includeGenerics - if true then the string includes generic information in this object. Otherwise this returns the same value as ObjectType.toString()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class org.apache.bcel.generic.Type
      • toPlainString

        public java.lang.String toPlainString()
      • getGenericParametersAsString

        public java.lang.String getGenericParametersAsString()