Class 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 Details

    • OBJECT

      public static TypeDef OBJECT
    • ENUM

      public static TypeDef ENUM
    • OBJECT_REF

      public static ClassRef OBJECT_REF
    • ENUM_REF

      public static ClassRef ENUM_REF
  • Constructor Details

  • Method Details

    • forName

      public static TypeDef forName(String fullyQualifiedName)
    • getFullyQualifiedName

      public String getFullyQualifiedName()
      Returns the fully qualified name of the type.
      Specified by:
      getFullyQualifiedName in interface Nameable
      Returns:
      the fully qualified name
    • getKind

      public Kind getKind()
    • getComments

      public List<String> getComments()
      Description copied from interface: Commentable
      Get the list of comments.
      Specified by:
      getComments in interface Commentable
      Returns:
      a List of comments.
    • getAnnotations

      public List<AnnotationRef> getAnnotations()
      Specified by:
      getAnnotations in interface Annotatable
    • getPackageName

      public String getPackageName()
      Description copied from interface: Nameable
      Get the package name
      Specified by:
      getPackageName in interface Nameable
      Returns:
      the package name.
    • getName

      public String getName()
      Description copied from interface: Nameable
      Get the name.
      Specified by:
      getName in interface Nameable
      Returns:
      the name
    • getExtendsList

      public List<ClassRef> getExtendsList()
    • getImplementsList

      public List<ClassRef> getImplementsList()
    • getParameters

      public List<TypeParamDef> getParameters()
    • getProperties

      public List<Property> getProperties()
    • getConstructors

      public List<Method> getConstructors()
    • getMethods

      public List<Method> getMethods()
    • getOuterTypeName

      public String getOuterTypeName()
    • getInnerTypes

      public List<TypeDef> getInnerTypes()
    • isClass

      public boolean isClass()
    • isInterface

      public boolean isInterface()
    • isEnum

      public boolean isEnum()
    • isAnnotation

      public boolean isAnnotation()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toReference

      public ClassRef toReference(TypeRef... arguments)
      Creates a ClassRef for the current definition with the specified arguments.
      Parameters:
      arguments - The arguments to be passed to the reference.
      Returns:
      a ClassRef for the currnet type, with the specified type arguments
    • toReference

      public ClassRef toReference(List<TypeRef> arguments)
      Creates a ClassRef for the current definition with the specified arguments.
      Parameters:
      arguments - The arguments to be passed to the reference.
      Returns:
      a ClassRef for the currnet type, with the specified type arguments
    • toReference

      public ClassRef toReference(Collection<TypeRef> arguments)
      Creates a ClassRef for the current definition with the specified arguments.
      Parameters:
      arguments - The arguments to be passed to the reference.
      Returns:
      a ClassRef for the currnet type, with the specified type arguments
    • toInternalReference

      public ClassRef toInternalReference()
      Creates a ClassRef for internal use inside the scope of the type (methods, properties etc). It uses as arguments the same 'letters' as the parameters definition.
      Returns:
      a ClassRef for the currnet type, using the type parameter names as as arguments.
    • toUnboundedReference

      public ClassRef toUnboundedReference()
      Creates a ClassRef without bounds.
      Returns:
      a ClassRef for the currnet type, with the specified type arguments
    • getImports

      public Set<String> getImports()
    • getReferences

      public List<ClassRef> getReferences()
    • renderDefinition

      public String renderDefinition()
    • renderDefinition

      public void renderDefinition(StringBuilder sb)
    • render

      public String render()
      Description copied from interface: Renderable
      Render the type into a String 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.
      Specified by:
      render in interface Renderable
      Returns:
      the String representation of the object as it's meant to appear in the generated code.
    • toString

      public String toString()
      Overrides:
      toString in class Object