Class QualifiedName

  • All Implemented Interfaces:
    java.lang.Comparable<QualifiedName>

    public class QualifiedName
    extends ValueType
    implements java.lang.Comparable<QualifiedName>
    The qualified name of a type. Lets us pass a type to a TypeShortener without a Class or javax.lang.model reference.
    • Field Detail

      • packageName

        private final java.lang.String packageName
      • simpleNames

        private final com.google.common.collect.ImmutableList<java.lang.String> simpleNames
    • Constructor Detail

      • QualifiedName

        private QualifiedName​(java.lang.String packageName,
                              com.google.common.collect.ImmutableList<java.lang.String> simpleNames)
    • Method Detail

      • of

        public static QualifiedName of​(java.lang.String packageName,
                                       java.lang.String topLevelType,
                                       java.lang.String... nestedTypes)
        Returns a QualifiedName for a type in packageName. If nestedTypes is empty, it is a top level type called topLevelType; otherwise, it is nested in that type.
      • toString

        public java.lang.String toString()
        Returns this qualified name as a string.

        Returns the same as Class.getName() and TypeElement.getQualifiedName() would for the same type, e.g. "java.lang.Integer" or "com.example.OuterType.InnerType".

        Overrides:
        toString in class ValueType
      • getPackage

        public java.lang.String getPackage()
      • getSimpleNames

        public com.google.common.collect.ImmutableList<java.lang.String> getSimpleNames()
      • getSimpleName

        public java.lang.String getSimpleName()
      • isTopLevel

        public boolean isTopLevel()
      • isNestedIn

        public boolean isNestedIn​(QualifiedName other)
      • nestedType

        public QualifiedName nestedType​(java.lang.String simpleName)
        Returns the QualifiedName of a type called simpleName nested in this one.
      • withParameters

        public TypeClass withParameters​(javax.lang.model.element.TypeParameterElement... parameters)
      • withParameters

        public Type withParameters​(javax.lang.model.type.TypeMirror first,
                                   javax.lang.model.type.TypeMirror... rest)
      • withParameters

        public TypeClass withParameters​(java.lang.Iterable<? extends javax.lang.model.element.TypeParameterElement> typeParameters)
      • compareTo

        public int compareTo​(QualifiedName o)
        Specified by:
        compareTo in interface java.lang.Comparable<QualifiedName>