Class Type


  • public class Type
    extends java.lang.Object
    A type.
     Type:
        Identifier [TypeArguments] { . Identifier [TypeArguments] } {[]}
        BasicType
     
    Version:
    1.0
    • Constructor Summary

      Constructors 
      Constructor Description
      Type()  
      Type​(java.lang.String identifier)  
      Type​(java.lang.String identifier, int bracketPairCount)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addIdentifier​(java.lang.String identifier, java.util.List<TypeArgument> typeArgs)
      Adds an identifier to this type.
      int getIdentifierCount()  
      java.lang.String getName​(boolean fullyQualified)
      Returns the name of this type.
      java.lang.String getName​(boolean fullyQualified, boolean addTypeArgs)
      Returns the name of this type.
      java.util.List<TypeArgument> getTypeArguments​(int index)
      Returns a set of type arguments by index.
      void incrementBracketPairCount​(int count)
      Increments an internally-used count of bracket pairs.
      boolean isArray()
      Returns whether this type is an array.
      boolean isBasicType()
      Returns whether this is a basic type (e.g.
      void setBracketPairCount​(int count)  
      java.lang.String toString()
      Returns a string representation of this type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • identifiers

        private java.util.List<java.lang.String> identifiers
      • typeArguments

        private java.util.List<java.util.List<TypeArgument>> typeArguments
      • bracketPairCount

        private int bracketPairCount
    • Constructor Detail

      • Type

        public Type()
      • Type

        public Type​(java.lang.String identifier)
      • Type

        public Type​(java.lang.String identifier,
                    int bracketPairCount)
    • Method Detail

      • addIdentifier

        public void addIdentifier​(java.lang.String identifier,
                                  java.util.List<TypeArgument> typeArgs)
        Adds an identifier to this type.
        Parameters:
        identifier - The identifier.
        typeArgs - The type arguments for the identifier. This may be null or an empty list if there are none.
      • getIdentifierCount

        public int getIdentifierCount()
      • getName

        public java.lang.String getName​(boolean fullyQualified)
        Returns the name of this type.
        Parameters:
        fullyQualified - Whether the returned value should be fully qualified.
        Returns:
        The name of this type. This will include type arguments, if any.
        See Also:
        getName(boolean, boolean)
      • getName

        public java.lang.String getName​(boolean fullyQualified,
                                        boolean addTypeArgs)
        Returns the name of this type.
        Parameters:
        fullyQualified - Whether the returned value should be fully qualified.
        addTypeArgs - Whether type arguments should be at the end of the returned string, if any.
        Returns:
        The name of this type.
        See Also:
        getName(boolean)
      • getTypeArguments

        public java.util.List<TypeArgument> getTypeArguments​(int index)
        Returns a set of type arguments by index.
        Parameters:
        index - The index.
        Returns:
        The type arguments.
      • incrementBracketPairCount

        public void incrementBracketPairCount​(int count)
        Increments an internally-used count of bracket pairs.
        Parameters:
        count - The amount to increment by.
      • isArray

        public boolean isArray()
        Returns whether this type is an array.
        Returns:
        Whether this type is an array.
      • isBasicType

        public boolean isBasicType()
        Returns whether this is a basic type (e.g. a primitive type).
        Returns:
        Whther this is a basic type.
      • setBracketPairCount

        public void setBracketPairCount​(int count)
      • toString

        public java.lang.String toString()
        Returns a string representation of this type. The type name will be fully qualified.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation of this type.
        See Also:
        getName(boolean)