public class TypeDef extends ModifierSupport implements Renderable, Nameable, Annotatable, Commentable, Mappable<TypeDef>
| Modifier and Type | Field and Description |
|---|---|
static TypeDef |
ENUM |
static ClassRef |
ENUM_REF |
static TypeDef |
OBJECT |
static ClassRef |
OBJECT_REF |
ABSTRACT, FINAL, modifiers, PRIVATE, PROTECTED, PUBLIC, STATIC, SYNCHRONIZEDIN_PACKAGE, IS_UPPER_CASE, OUT_OF_PACKAGE, PACKAGE_SEPARATOR_REGEXAT, CB, CC, CLP, COMA, CP, DOT, DQ, EQ, EXTENDS, GT, IMPLEMENTS, JAVA_LANG, JAVA_LANG_ENUM, JAVA_LANG_OBJECT, JAVA_LANG_STRING, LT, NEWLINE, OB, OC, OP, Q, SEMICOLN, SPACE, STAR, THROWS, VARARGALSO_IMPORT, DEFAULT_VALUE, INIT, INIT_FUNCTION, LAZY_INIT| Modifier | Constructor and Description |
|---|---|
|
TypeDef(Kind kind,
String packageName,
String name,
List<String> comments,
List<AnnotationRef> annotations,
List<ClassRef> extendsList,
List<ClassRef> implementsList,
List<TypeParamDef> parameters,
List<Property> properties,
List<Method> constructors,
List<Method> methods,
String outerTypeName,
List<TypeDef> innerTypes,
Modifiers modifiers,
Map<AttributeKey,Object> attributes) |
protected |
TypeDef(String fullyQualifiedName) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
static TypeDef |
forName(String fullyQualifiedName) |
List<AnnotationRef> |
getAnnotations() |
List<String> |
getComments()
Get the list of comments.
|
List<Method> |
getConstructors() |
List<ClassRef> |
getExtendsList() |
String |
getFullyQualifiedName()
Returns the fully qualified name of the type.
|
List<ClassRef> |
getImplementsList() |
Set<String> |
getImports() |
List<TypeDef> |
getInnerTypes() |
Kind |
getKind() |
List<Method> |
getMethods() |
String |
getName()
Get the name.
|
String |
getOuterTypeName() |
String |
getPackageName()
Get the package name
|
List<TypeParamDef> |
getParameters() |
List<Property> |
getProperties() |
List<ClassRef> |
getReferences() |
int |
hashCode() |
boolean |
isAnnotation() |
boolean |
isClass() |
boolean |
isEnum() |
boolean |
isInterface() |
String |
render()
Render the type into a
String for the purpose of code generation. |
String |
renderDefinition() |
void |
renderDefinition(StringBuilder sb) |
ClassRef |
toInternalReference()
Creates a
ClassRef for internal use inside the scope of the type (methods, properties
etc). |
ClassRef |
toReference(Collection<TypeRef> arguments)
Creates a
ClassRef for the current definition with the specified arguments. |
ClassRef |
toReference(List<TypeRef> arguments)
Creates a
ClassRef for the current definition with the specified arguments. |
ClassRef |
toReference(TypeRef... arguments)
Creates a
ClassRef for the current definition with the specified arguments. |
String |
toString() |
ClassRef |
toUnboundedReference()
Creates a
ClassRef without bounds. |
getModifiers, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isSynchronized, isTransient, renderModifiers, renderModifiersgetAttribute, getAttributes, hasAttributeclone, finalize, getClass, notify, notifyAll, wait, wait, waitrenderafter, getClassName, getOuterTypeName, getPackageName, untilrenderAnnotationsrenderCommentspublic static TypeDef OBJECT
public static TypeDef ENUM
public static ClassRef OBJECT_REF
public static ClassRef ENUM_REF
public TypeDef(Kind kind, String packageName, String name, List<String> comments, List<AnnotationRef> annotations, List<ClassRef> extendsList, List<ClassRef> implementsList, List<TypeParamDef> parameters, List<Property> properties, List<Method> constructors, List<Method> methods, String outerTypeName, List<TypeDef> innerTypes, Modifiers modifiers, Map<AttributeKey,Object> attributes)
protected TypeDef(String fullyQualifiedName)
public String getFullyQualifiedName()
getFullyQualifiedName in interface Nameablepublic Kind getKind()
public List<String> getComments()
CommentablegetComments in interface CommentableList of comments.public List<AnnotationRef> getAnnotations()
getAnnotations in interface Annotatablepublic String getPackageName()
NameablegetPackageName in interface Nameablepublic List<TypeParamDef> getParameters()
public String getOuterTypeName()
public boolean isClass()
public boolean isInterface()
public boolean isEnum()
public boolean isAnnotation()
public ClassRef toReference(TypeRef... arguments)
ClassRef for the current definition with the specified arguments.arguments - The arguments to be passed to the reference.ClassRef for the currnet type, with the specified type argumentspublic ClassRef toReference(List<TypeRef> arguments)
ClassRef for the current definition with the specified arguments.arguments - The arguments to be passed to the reference.ClassRef for the currnet type, with the specified type argumentspublic ClassRef toReference(Collection<TypeRef> arguments)
ClassRef for the current definition with the specified arguments.arguments - The arguments to be passed to the reference.ClassRef for the currnet type, with the specified type argumentspublic ClassRef toInternalReference()
ClassRef for internal use inside the scope of the type (methods, properties
etc). It uses as arguments the same 'letters' as the parameters definition.ClassRef for the currnet type, using the type parameter names as as arguments.public ClassRef toUnboundedReference()
ClassRef without bounds.ClassRef for the currnet type, with the specified type argumentspublic String renderDefinition()
public void renderDefinition(StringBuilder sb)
public String render()
RenderableString for the purpose of code generation.
This is slightly different from the `toString()` method as `toString()` is mostly needed for logging / debugging and should
be idempotent.
Regarding idempotency this method may yield different result based on the context it is used even if the internal state of
the object does not change.
An example of such case, is a reference to class that may change based on the package from which it's refenced.render in interface RenderableString representation of the object as it's meant to appear in the generated code.Copyright © 2023. All rights reserved.