Record Class AnnotationInfo

java.lang.Object
java.lang.Record
io.github.torand.openapi2java.model.AnnotationInfo
Record Components:
annotation - the annotation.
imports - the imports required by the annotation.
All Implemented Interfaces:
ImportsSupplier

public record AnnotationInfo(String annotation, ImportInfo imports) extends Record implements ImportsSupplier
Describes an annotation.
  • Constructor Details

    • AnnotationInfo

      public AnnotationInfo()
      Constructs an AnnotationInfo object.
    • AnnotationInfo

      public AnnotationInfo(String annotation)
      Constructs an AnnotationInfo object.
      Parameters:
      annotation - the annoation.
    • AnnotationInfo

      public AnnotationInfo(String annotation, String annotationImport)
      Constructs an AnnotationInfo object.
      Parameters:
      annotation - the annotation.
      annotationImport - the import required by the annotation.
    • AnnotationInfo

      public AnnotationInfo(String annotation, ImportInfo imports)
      Creates an instance of a AnnotationInfo record class.
      Parameters:
      annotation - the value for the annotation record component
      imports - the value for the imports record component
  • Method Details

    • withAnnotation

      public AnnotationInfo withAnnotation(String annotation)
      Returns a new AnnotationInfo object with annotation.
      Parameters:
      annotation - the annotation.
      Returns:
      the new and updated AnnotationInfo object.
    • withAddedNormalImport

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

      public AnnotationInfo withAddedStaticImport(String staticImport)
      Returns a new AnnotationInfo object with specified static import added.
      Parameters:
      staticImport - the static import to add.
      Returns:
      the new and updated AnnotationInfo object.
    • withAddedImports

      public AnnotationInfo withAddedImports(ImportsSupplier importSupplier)
      Returns a new AnnotationInfo object with specified imports added.
      Parameters:
      importSupplier - the imports to add.
      Returns:
      the new and updated AnnotationInfo object.
    • withAddedImports

      public AnnotationInfo withAddedImports(Collection<? extends ImportsSupplier> importSuppliers)
      Returns a new AnnotationInfo object with specified imports added.
      Parameters:
      importSuppliers - the imports to add.
      Returns:
      the new and updated AnnotationInfo object.
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • annotation

      public String annotation()
      Returns the value of the annotation record component.
      Returns:
      the value of the annotation 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