Class GenericObjectType

java.lang.Object
org.apache.bcel.generic.Type
org.apache.bcel.generic.ReferenceType
org.apache.bcel.generic.ObjectType
edu.umd.cs.findbugs.ba.generic.GenericObjectType

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
  • 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

    Modifier and Type
    Method
    Description
    boolean
     
    org.apache.bcel.generic.Type
     
     
    int
     
    org.apache.bcel.generic.ObjectType
     
    org.apache.bcel.generic.ReferenceType
    getParameterAt(int index)
     
    List<? extends org.apache.bcel.generic.ReferenceType>
     
    Get the TypeCategory that represents this Object
    org.apache.bcel.generic.Type
     
     
    int
     
    boolean
     
    org.apache.bcel.generic.ReferenceType
     
     
     
    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, normalizeForStackOrLocal

    Methods inherited from class java.lang.Object

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

    • 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(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 String getVariable()
      Returns:
      Returns the variable.
    • getTypeCategory

      public GenericUtilities.TypeCategory getTypeCategory()
      Get the TypeCategory that represents this Object
      See Also:
    • 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 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 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 String toString()
      Overrides:
      toString in class org.apache.bcel.generic.Type
    • toPlainString

      public String toPlainString()
    • getGenericParametersAsString

      public String getGenericParametersAsString()