Modifier and Type | Method and Description |
---|---|
ClassName |
annotated(java.util.List<AnnotationSpec> annotations) |
static ClassName |
bestGuess(java.lang.String classNameString)
Returns a new
ClassName instance for the given fully-qualified class name string. |
java.lang.String |
canonicalName()
Returns the full class name of this class.
|
int |
compareTo(ClassName o) |
ClassName |
enclosingClassName()
Returns the enclosing class, like
Map for Map.Entry . |
static ClassName |
get(java.lang.Class<?> clazz) |
static ClassName |
get(java.lang.String packageName,
java.lang.String simpleName,
java.lang.String... simpleNames)
Returns a class name created from the given parts.
|
static ClassName |
get(javax.lang.model.element.TypeElement element)
Returns the class name for
element . |
boolean |
isAnnotated() |
ClassName |
nestedClass(java.lang.String name)
Returns a new
ClassName instance for the specified name as nested inside this
class. |
java.lang.String |
packageName()
Returns the package name, like
"java.util" for Map.Entry . |
ClassName |
peerClass(java.lang.String name)
Returns a class that shares the same enclosing package or class.
|
java.lang.String |
reflectionName()
Return the binary name of a class.
|
java.lang.String |
simpleName()
Returns the simple name of this class, like
"Entry" for Map.Entry . |
java.util.List<java.lang.String> |
simpleNames() |
ClassName |
topLevelClassName()
Returns the top class in this nesting group.
|
ClassName |
withoutAnnotations() |
annotated, box, concatAnnotations, equals, get, get, hashCode, isBoxedPrimitive, isPrimitive, toString, unbox
public static final ClassName OBJECT
public ClassName annotated(java.util.List<AnnotationSpec> annotations)
public ClassName withoutAnnotations()
withoutAnnotations
in class TypeName
public boolean isAnnotated()
isAnnotated
in class TypeName
public java.lang.String packageName()
"java.util"
for Map.Entry
. Returns the empty
string for the default package.public ClassName enclosingClassName()
Map
for Map.Entry
. Returns null if this class
is not nested in another class.public ClassName topLevelClassName()
enclosingClassName()
until the result's enclosing class is null.public java.lang.String reflectionName()
public java.util.List<java.lang.String> simpleNames()
public ClassName peerClass(java.lang.String name)
enclosingClassName().nestedClass(name)
. Otherwise
it is equivalent to get(packageName(), name)
.public ClassName nestedClass(java.lang.String name)
ClassName
instance for the specified name
as nested inside this
class.public java.lang.String simpleName()
"Entry"
for Map.Entry
.public java.lang.String canonicalName()
"java.util.Map.Entry"
for Map.Entry
.public static ClassName get(java.lang.Class<?> clazz)
public static ClassName bestGuess(java.lang.String classNameString)
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(Class)
and
get(Class)
should be preferred as they can correctly create ClassName
instances without such restrictions.public static ClassName get(java.lang.String packageName, java.lang.String simpleName, java.lang.String... simpleNames)
"java.util"
and simple names "Map"
, "Entry"
yields Map.Entry
.public static ClassName get(javax.lang.model.element.TypeElement element)
element
.Copyright © 2020 Square, Inc.. All Rights Reserved.