class ClassName : TypeName, Comparable<ClassName>
A fully-qualified class name for top-level and member classes.
ClassName(packageName: String, simpleName: String, vararg simpleNames: String)
Returns a class name created from the given parts. For example, calling this with package name
|
val canonicalName: String
Fully qualified name using |
|
val packageName: String
Package name, like |
|
val simpleName: String
Simple name of this class, like |
|
val simpleNames: List<String>
The enclosing classes, outermost first, followed by the simple name. This is |
val annotations: List<AnnotationSpec> |
|
val isAnnotated: Boolean |
|
val isNullable: Boolean |
fun compareTo(other: ClassName): Int
Orders by the fully-qualified name. Nested types are ordered immediately after their enclosing type. For example, the following types are ordered by this method: |
|
fun constructorReference(): CodeBlock
Callable reference to the constructor of this class. Emits the enclosing class if one exists,
followed by the reference operator |
|
fun copy(nullable: Boolean, annotations: List<AnnotationSpec>): ClassName |
|
fun enclosingClassName(): ClassName?
Returns the enclosing class, like |
|
fun nestedClass(name: String): ClassName
Returns a new ClassName instance for the specified |
|
fun peerClass(name: String): ClassName
Returns a class that shares the same enclosing package or class. If this class is enclosed by
another class, this is equivalent to |
|
fun reflectionName(): String
Fully qualified name using |
|
fun topLevelClassName(): ClassName
Returns the top class in this nesting group. Equivalent to chained calls to ClassName.enclosingClassName until the result's enclosing class is null. |
open fun equals(other: Any?): Boolean |
|
open fun hashCode(): Int |
|
open fun toString(): String |
fun bestGuess(classNameString: String): ClassName
Returns a new ClassName instance for the given fully-qualified class name 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, the constructor should be preferred as it can create ClassName instances without such restrictions. |
fun TypeName.jvmSuppressWildcards(suppress: Boolean = true): TypeName |
|
fun TypeName.jvmWildcard(): TypeName |