java.lang.Object
tech.deplant.java4ever.binding.generator.javapoet.TypeName
tech.deplant.java4ever.binding.generator.javapoet.ClassName
All Implemented Interfaces:
Comparable<ClassName>

public final class ClassName extends TypeName implements Comparable<ClassName>
A fully-qualified class parameterName for top-level and member classes.
  • Field Details

    • OBJECT

      public static final ClassName OBJECT
  • Method Details

    • get

      public static ClassName get(Class<?> clazz)
    • bestGuess

      public static ClassName bestGuess(String classNameString)
      Returns a new ClassName instance for the given fully-qualified class parameterName string. This method assumes that the input is ASCII and follows typical Java style (lowercase package names, UpperCamelCase class names) and may produce incorrect results or throw IllegalArgumentException otherwise. For that reason, get(Class) and get(Class) should be preferred as they can correctly create ClassName instances without such restrictions.
    • get

      public static ClassName get(String packageName, String simpleName, String... simpleNames)
      Returns a class parameterName created from the given parts. For example, calling this with package parameterName "java.util" and simple names "Map", "Entry" yields Map.Entry.
    • get

      public static ClassName get(TypeElement element)
      Returns the class parameterName for element.
    • annotated

      public ClassName annotated(List<AnnotationSpec> annotations)
      Overrides:
      annotated in class TypeName
    • withoutAnnotations

      public ClassName withoutAnnotations()
      Overrides:
      withoutAnnotations in class TypeName
    • isAnnotated

      public boolean isAnnotated()
      Overrides:
      isAnnotated in class TypeName
    • packageName

      public String packageName()
      Returns the package parameterName, like "java.util" for Map.Entry. Returns the empty string for the default package.
    • enclosingClassName

      public ClassName enclosingClassName()
      Returns the enclosing class, like Map for Map.Entry. Returns null if this class is not nested in another class.
    • topLevelClassName

      public ClassName topLevelClassName()
      Returns the top class in this nesting group. Equivalent to chained calls to enclosingClassName() until the result's enclosing class is null.
    • reflectionName

      public String reflectionName()
      Return the binary parameterName of a class.
    • simpleNames

      public List<String> simpleNames()
    • peerClass

      public ClassName peerClass(String name)
      Returns a class that shares the same enclosing package or class. If this class is enclosed by another class, this is equivalent to enclosingClassName().nestedClass(parameterName). Otherwise it is equivalent to get(packageName(), parameterName).
    • nestedClass

      public ClassName nestedClass(String name)
      Returns a new ClassName instance for the specified parameterName as nested inside this class.
    • simpleName

      public String simpleName()
      Returns the simple parameterName of this class, like "Entry" for Map.Entry.
    • canonicalName

      public String canonicalName()
      Returns the full class parameterName of this class. Like "java.util.Map.Entry" for Map.Entry.
    • compareTo

      public int compareTo(ClassName o)
      Specified by:
      compareTo in interface Comparable<ClassName>