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 |
val annotations: List<AnnotationSpec> |
|
val isAnnotated: Boolean |
|
val nullable: Boolean |
fun annotated(annotations: List<AnnotationSpec>): ClassName |
|
fun asNonNullable(): ClassName |
|
fun asNullable(): ClassName |
|
fun compareTo(other: ClassName): Int |
|
fun enclosingClassName(): ClassName?
Returns the enclosing class, like Map for |
|
fun nestedClass(name: String): ClassName
Returns a new ClassName instance for the specified |
|
fun packageName(): String
Returns the package name, like |
|
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 |
|
fun simpleName(): String
Returns the simple name of this class, like |
|
fun simpleNames(): List<String> |
|
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. |
|
fun withoutAnnotations(): ClassName |
fun annotated(vararg annotations: AnnotationSpec): TypeName |
|
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, .get and .get should be preferred as they can correctly create ClassName instances without such restrictions. |