Record Class TypeInfo

java.lang.Object
java.lang.Record
io.github.torand.openapi2java.model.TypeInfo
Record Components:
name - the type name.
description - the type description.
nullable - the nullable flag.
keyType - the key type, if this is a map type.
primitive - the primitive flag.
itemType - the item type, if this is an array type or map type.
schemaFormat - the OpenAPI schema format.
schemaPattern - the OpenAPI schema pattern.
annotations - the annotations decorating this type.
imports - the imports required by the type.
All Implemented Interfaces:
EntityInfo, ImportsSupplier

public record TypeInfo(String name, String description, boolean nullable, TypeInfo keyType, boolean primitive, TypeInfo itemType, String schemaFormat, String schemaPattern, List<AnnotationInfo> annotations, ImportInfo imports) extends Record implements EntityInfo, ImportsSupplier
Describes a type.
  • Constructor Details

    • TypeInfo

      public TypeInfo()
      Constructs an TypeInfo object.
    • TypeInfo

      public TypeInfo(String name, String description, boolean nullable, TypeInfo keyType, boolean primitive, TypeInfo itemType, String schemaFormat, String schemaPattern, List<AnnotationInfo> annotations, ImportInfo imports)
      Creates an instance of a TypeInfo record class.
      Parameters:
      name - the value for the name record component
      description - the value for the description record component
      nullable - the value for the nullable record component
      keyType - the value for the keyType record component
      primitive - the value for the primitive record component
      itemType - the value for the itemType record component
      schemaFormat - the value for the schemaFormat record component
      schemaPattern - the value for the schemaPattern record component
      annotations - the value for the annotations record component
      imports - the value for the imports record component
  • Method Details

    • withName

      public TypeInfo withName(String name)
      Returns a new TypeInfo object with specified name.
      Parameters:
      name - the name.
      Returns:
      the new and updated TypeInfo object.
    • withDescription

      public TypeInfo withDescription(String description)
      Returns a new TypeInfo object with specified description.
      Parameters:
      description - the description.
      Returns:
      the new and updated TypeInfo object.
    • withNullable

      public TypeInfo withNullable(boolean nullable)
      Returns a new TypeInfo object with specified nullable flag.
      Parameters:
      nullable - the nullable flag.
      Returns:
      the new and updated TypeInfo object.
    • withKeyType

      public TypeInfo withKeyType(TypeInfo keyType)
      Returns a new TypeInfo object with specified key type.
      Parameters:
      keyType - the key type.
      Returns:
      the new and updated TypeInfo object.
    • withPrimitive

      public TypeInfo withPrimitive(boolean primitive)
      Returns a new TypeInfo object with specified primitive flag.
      Parameters:
      primitive - the primitive flag.
      Returns:
      the new and updated TypeInfo object.
    • withItemType

      public TypeInfo withItemType(TypeInfo itemType)
      Returns a new TypeInfo object with specified item type.
      Parameters:
      itemType - the item type.
      Returns:
      the new and updated TypeInfo object.
    • withSchemaFormat

      public TypeInfo withSchemaFormat(String schemaFormat)
      Returns a new TypeInfo object with specified OpenAPI schema format.
      Parameters:
      schemaFormat - the OpenAPI schema format.
      Returns:
      the new and updated TypeInfo object.
    • withSchemaPattern

      public TypeInfo withSchemaPattern(String schemaPattern)
      Returns a new TypeInfo object with specified OpenAPI schema pattern.
      Parameters:
      schemaPattern - the OpenAPI schema pattern.
      Returns:
      the new and updated TypeInfo object.
    • withAddedAnnotation

      public TypeInfo withAddedAnnotation(AnnotationInfo annotation)
      Returns a new TypeInfo object with specified annotation added.
      Parameters:
      annotation - the annotation to add.
      Returns:
      the new and updated TypeInfo object.
    • withNoAnnotations

      public TypeInfo withNoAnnotations()
      Returns a new PojoInfo object with no annotations.
      Returns:
      the new and updated PojoInfo object.
    • withAddedNormalImport

      public TypeInfo withAddedNormalImport(String normalImport)
      Returns a new TypeInfo object with specified normal import added.
      Parameters:
      normalImport - the import to add.
      Returns:
      the new and updated TypeInfo object.
    • isArray

      public boolean isArray()
      Gets whether this is an array type.
      Returns:
      true if this is an array type; else false.
    • getFullName

      public String getFullName()
      Gets the full name of Java/Kotlin type including generic composites.
      Returns:
      the full name of Java/Kotlin type
    • getAnnotatedFullName

      public AnnotatedTypeName getAnnotatedFullName()
      Gets full type name, including bean validation annotations.
      Returns:
      the annotations and type name items.
    • aggregatedNormalImports

      public Set<String> aggregatedNormalImports()
      Description copied from interface: EntityInfo
      Gets the complete set of normal imports for this entity and its sub-entities.
      Specified by:
      aggregatedNormalImports in interface EntityInfo
      Returns:
      the aggregated set of normal imports.
    • aggregatedStaticImports

      public Set<String> aggregatedStaticImports()
      Description copied from interface: EntityInfo
      Gets the complete set of static imports for this entity and its sub-entities.
      Specified by:
      aggregatedStaticImports in interface EntityInfo
      Returns:
      the aggregated set of static imports.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • description

      public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • nullable

      public boolean nullable()
      Returns the value of the nullable record component.
      Returns:
      the value of the nullable record component
    • keyType

      public TypeInfo keyType()
      Returns the value of the keyType record component.
      Returns:
      the value of the keyType record component
    • primitive

      public boolean primitive()
      Returns the value of the primitive record component.
      Returns:
      the value of the primitive record component
    • itemType

      public TypeInfo itemType()
      Returns the value of the itemType record component.
      Returns:
      the value of the itemType record component
    • schemaFormat

      public String schemaFormat()
      Returns the value of the schemaFormat record component.
      Returns:
      the value of the schemaFormat record component
    • schemaPattern

      public String schemaPattern()
      Returns the value of the schemaPattern record component.
      Returns:
      the value of the schemaPattern record component
    • annotations

      public List<AnnotationInfo> annotations()
      Returns the value of the annotations record component.
      Specified by:
      annotations in interface EntityInfo
      Returns:
      the value of the annotations record component
    • imports

      public ImportInfo imports()
      Returns the value of the imports record component.
      Specified by:
      imports in interface ImportsSupplier
      Returns:
      the value of the imports record component