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 Summary
ConstructorsConstructorDescriptionTypeInfo()Constructs anTypeInfoobject.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 aTypeInforecord class. -
Method Summary
Modifier and TypeMethodDescriptionGets the complete set of normal imports for this entity and its sub-entities.Gets the complete set of static imports for this entity and its sub-entities.Returns the value of theannotationsrecord component.Returns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.Gets full type name, including bean validation annotations.Gets the full name of Java/Kotlin type including generic composites.final inthashCode()Returns a hash code value for this object.imports()Returns the value of theimportsrecord component.booleanisArray()Gets whether this is an array type.itemType()Returns the value of theitemTyperecord component.keyType()Returns the value of thekeyTyperecord component.name()Returns the value of thenamerecord component.booleannullable()Returns the value of thenullablerecord component.booleanReturns the value of theprimitiverecord component.Returns the value of theschemaFormatrecord component.Returns the value of theschemaPatternrecord component.final StringtoString()Returns a string representation of this record class.withAddedAnnotation(AnnotationInfo annotation) Returns a newTypeInfoobject with specified annotation added.withAddedNormalImport(String normalImport) Returns a newTypeInfoobject with specified normal import added.withDescription(String description) Returns a newTypeInfoobject with specified description.withItemType(TypeInfo itemType) Returns a newTypeInfoobject with specified item type.withKeyType(TypeInfo keyType) Returns a newTypeInfoobject with specified key type.Returns a newTypeInfoobject with specified name.Returns a newPojoInfoobject with no annotations.withNullable(boolean nullable) Returns a newTypeInfoobject with specified nullable flag.withPrimitive(boolean primitive) Returns a newTypeInfoobject with specified primitive flag.withSchemaFormat(String schemaFormat) Returns a newTypeInfoobject with specified OpenAPI schema format.withSchemaPattern(String schemaPattern) Returns a newTypeInfoobject with specified OpenAPI schema pattern.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.github.torand.openapi2java.model.EntityInfo
aggregatedImports, annotationsAsStrings
-
Constructor Details
-
TypeInfo
public TypeInfo()Constructs anTypeInfoobject. -
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 aTypeInforecord class.- Parameters:
name- the value for thenamerecord componentdescription- the value for thedescriptionrecord componentnullable- the value for thenullablerecord componentkeyType- the value for thekeyTyperecord componentprimitive- the value for theprimitiverecord componentitemType- the value for theitemTyperecord componentschemaFormat- the value for theschemaFormatrecord componentschemaPattern- the value for theschemaPatternrecord componentannotations- the value for theannotationsrecord componentimports- the value for theimportsrecord component
-
-
Method Details
-
withName
Returns a newTypeInfoobject with specified name.- Parameters:
name- the name.- Returns:
- the new and updated
TypeInfoobject.
-
withDescription
Returns a newTypeInfoobject with specified description.- Parameters:
description- the description.- Returns:
- the new and updated
TypeInfoobject.
-
withNullable
Returns a newTypeInfoobject with specified nullable flag.- Parameters:
nullable- the nullable flag.- Returns:
- the new and updated
TypeInfoobject.
-
withKeyType
Returns a newTypeInfoobject with specified key type.- Parameters:
keyType- the key type.- Returns:
- the new and updated
TypeInfoobject.
-
withPrimitive
Returns a newTypeInfoobject with specified primitive flag.- Parameters:
primitive- the primitive flag.- Returns:
- the new and updated
TypeInfoobject.
-
withItemType
Returns a newTypeInfoobject with specified item type.- Parameters:
itemType- the item type.- Returns:
- the new and updated
TypeInfoobject.
-
withSchemaFormat
Returns a newTypeInfoobject with specified OpenAPI schema format.- Parameters:
schemaFormat- the OpenAPI schema format.- Returns:
- the new and updated
TypeInfoobject.
-
withSchemaPattern
Returns a newTypeInfoobject with specified OpenAPI schema pattern.- Parameters:
schemaPattern- the OpenAPI schema pattern.- Returns:
- the new and updated
TypeInfoobject.
-
withAddedAnnotation
Returns a newTypeInfoobject with specified annotation added.- Parameters:
annotation- the annotation to add.- Returns:
- the new and updated
TypeInfoobject.
-
withNoAnnotations
Returns a newPojoInfoobject with no annotations.- Returns:
- the new and updated
PojoInfoobject.
-
withAddedNormalImport
Returns a newTypeInfoobject with specified normal import added.- Parameters:
normalImport- the import to add.- Returns:
- the new and updated
TypeInfoobject.
-
isArray
public boolean isArray()Gets whether this is an array type.- Returns:
- true if this is an array type; else false.
-
getFullName
Gets the full name of Java/Kotlin type including generic composites.- Returns:
- the full name of Java/Kotlin type
-
getAnnotatedFullName
Gets full type name, including bean validation annotations.- Returns:
- the annotations and type name items.
-
aggregatedNormalImports
Description copied from interface:EntityInfoGets the complete set of normal imports for this entity and its sub-entities.- Specified by:
aggregatedNormalImportsin interfaceEntityInfo- Returns:
- the aggregated set of normal imports.
-
aggregatedStaticImports
Description copied from interface:EntityInfoGets the complete set of static imports for this entity and its sub-entities.- Specified by:
aggregatedStaticImportsin interfaceEntityInfo- Returns:
- the aggregated set of static imports.
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
nullable
public boolean nullable()Returns the value of thenullablerecord component.- Returns:
- the value of the
nullablerecord component
-
keyType
Returns the value of thekeyTyperecord component.- Returns:
- the value of the
keyTyperecord component
-
primitive
public boolean primitive()Returns the value of theprimitiverecord component.- Returns:
- the value of the
primitiverecord component
-
itemType
Returns the value of theitemTyperecord component.- Returns:
- the value of the
itemTyperecord component
-
schemaFormat
Returns the value of theschemaFormatrecord component.- Returns:
- the value of the
schemaFormatrecord component
-
schemaPattern
Returns the value of theschemaPatternrecord component.- Returns:
- the value of the
schemaPatternrecord component
-
annotations
Returns the value of theannotationsrecord component.- Specified by:
annotationsin interfaceEntityInfo- Returns:
- the value of the
annotationsrecord component
-
imports
Returns the value of theimportsrecord component.- Specified by:
importsin interfaceImportsSupplier- Returns:
- the value of the
importsrecord component
-