Package io.sundr.model
Class TypeDef
- java.lang.Object
-
- io.sundr.model.AttributeSupport
-
- io.sundr.model.ModifierSupport
-
- io.sundr.model.TypeDef
-
- All Implemented Interfaces:
Annotatable,Attributeable,Commentable,Mappable<TypeDef>,Nameable,Node,Renderable
public class TypeDef extends ModifierSupport implements Renderable, Nameable, Annotatable, Commentable, Mappable<TypeDef>
-
-
Field Summary
Fields Modifier and Type Field Description static TypeDefENUMstatic ClassRefENUM_REFstatic TypeDefOBJECTstatic ClassRefOBJECT_REF-
Fields inherited from class io.sundr.model.ModifierSupport
ABSTRACT, FINAL, modifiers, PRIVATE, PROTECTED, PUBLIC, STATIC, SYNCHRONIZED
-
Fields inherited from interface io.sundr.model.Attributeable
ALSO_IMPORT, DEFAULT_VALUE, INIT, INIT_FUNCTION, LAZY_INIT
-
Fields inherited from interface io.sundr.model.Nameable
IN_PACKAGE, IS_UPPER_CASE, OUT_OF_PACKAGE, PACKAGE_SEPARATOR_REGEX
-
Fields inherited from interface io.sundr.model.Node
AT, CB, CC, CLP, COLN, COMA, CP, DOT, DQ, EMPTY, EQ, EXTENDS, GT, IMPLEMENTS, INDENT, JAVA_LANG, JAVA_LANG_ENUM, JAVA_LANG_OBJECT, JAVA_LANG_STRING, LT, NEWLINE, NEWLINE_PATTERN, OB, OC, OP, Q, SEMICOLN, SEMICOLN_SUFFIX_PATTERN, SPACE, STAR, THROWS, VARARG
-
-
Constructor Summary
Constructors Modifier Constructor 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)protectedTypeDef(String fullyQualifiedName)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)static TypeDefforName(String fullyQualifiedName)List<AnnotationRef>getAnnotations()List<String>getComments()Get the list of comments.List<Method>getConstructors()List<ClassRef>getExtendsList()StringgetFullyQualifiedName()Returns the fully qualified name of the type.List<ClassRef>getImplementsList()Set<String>getImports()List<TypeDef>getInnerTypes()KindgetKind()List<Method>getMethods()StringgetName()Get the name.StringgetOuterTypeName()StringgetPackageName()Get the package nameList<TypeParamDef>getParameters()List<Property>getProperties()List<ClassRef>getReferences()inthashCode()booleanisAnnotation()booleanisClass()booleanisEnum()booleanisInterface()Stringrender()Render the type into aStringfor the purpose of code generation.StringrenderDefinition()voidrenderDefinition(StringBuilder sb)ClassReftoInternalReference()Creates aClassReffor internal use inside the scope of the type (methods, properties etc).ClassReftoReference(TypeRef... arguments)Creates aClassReffor the current definition with the specified arguments.ClassReftoReference(Collection<TypeRef> arguments)Creates aClassReffor the current definition with the specified arguments.ClassReftoReference(List<TypeRef> arguments)Creates aClassReffor the current definition with the specified arguments.StringtoString()ClassReftoUnboundedReference()Creates aClassRefwithout bounds.-
Methods inherited from class io.sundr.model.ModifierSupport
getModifiers, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isSynchronized, isTransient, renderModifiers, renderModifiers
-
Methods inherited from class io.sundr.model.AttributeSupport
getAttribute, getAttributes, hasAttribute
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.sundr.model.Annotatable
renderAnnotations
-
Methods inherited from interface io.sundr.model.Commentable
renderComments
-
Methods inherited from interface io.sundr.model.Renderable
tab
-
-
-
-
Constructor Detail
-
TypeDef
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)
-
TypeDef
protected TypeDef(String fullyQualifiedName)
-
-
Method Detail
-
getFullyQualifiedName
public String getFullyQualifiedName()
Returns the fully qualified name of the type.- Specified by:
getFullyQualifiedNamein interfaceNameable- Returns:
- the fully qualified name
-
getKind
public Kind getKind()
-
getComments
public List<String> getComments()
Description copied from interface:CommentableGet the list of comments.- Specified by:
getCommentsin interfaceCommentable- Returns:
- a
Listof comments.
-
getAnnotations
public List<AnnotationRef> getAnnotations()
- Specified by:
getAnnotationsin interfaceAnnotatable
-
getPackageName
public String getPackageName()
Description copied from interface:NameableGet the package name- Specified by:
getPackageNamein interfaceNameable- Returns:
- the package name.
-
getParameters
public List<TypeParamDef> getParameters()
-
getOuterTypeName
public String getOuterTypeName()
-
isClass
public boolean isClass()
-
isInterface
public boolean isInterface()
-
isEnum
public boolean isEnum()
-
isAnnotation
public boolean isAnnotation()
-
toReference
public ClassRef toReference(TypeRef... arguments)
Creates aClassReffor the current definition with the specified arguments.- Parameters:
arguments- The arguments to be passed to the reference.- Returns:
- a
ClassReffor the currnet type, with the specified type arguments
-
toReference
public ClassRef toReference(List<TypeRef> arguments)
Creates aClassReffor the current definition with the specified arguments.- Parameters:
arguments- The arguments to be passed to the reference.- Returns:
- a
ClassReffor the currnet type, with the specified type arguments
-
toReference
public ClassRef toReference(Collection<TypeRef> arguments)
Creates aClassReffor the current definition with the specified arguments.- Parameters:
arguments- The arguments to be passed to the reference.- Returns:
- a
ClassReffor the currnet type, with the specified type arguments
-
toInternalReference
public ClassRef toInternalReference()
Creates aClassReffor internal use inside the scope of the type (methods, properties etc). It uses as arguments the same 'letters' as the parameters definition.- Returns:
- a
ClassReffor the currnet type, using the type parameter names as as arguments.
-
toUnboundedReference
public ClassRef toUnboundedReference()
Creates aClassRefwithout bounds.- Returns:
- a
ClassReffor the currnet type, with the specified type arguments
-
renderDefinition
public String renderDefinition()
-
renderDefinition
public void renderDefinition(StringBuilder sb)
-
render
public String render()
Description copied from interface:RenderableRender the type into aStringfor 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.- Specified by:
renderin interfaceRenderable- Returns:
- the
Stringrepresentation of the object as it's meant to appear in the generated code.
-
-