Record Class ImportInfo

java.lang.Object
java.lang.Record
io.github.torand.openapi2java.model.ImportInfo
Record Components:
normalImports - the normal (non-static) imports.
staticImports - the static imports.
All Implemented Interfaces:
ImportsSupplier

public record ImportInfo(Set<String> normalImports, Set<String> staticImports) extends Record implements ImportsSupplier
Describes a collection of imports and static imports.
  • Constructor Details

    • ImportInfo

      public ImportInfo(Set<String> normalImports, Set<String> staticImports)
      Creates an instance of a ImportInfo record class.
      Parameters:
      normalImports - the value for the normalImports record component
      staticImports - the value for the staticImports record component
  • Method Details

    • empty

      public static ImportInfo empty()
      Creates an ImportInfo object with no imports.
      Returns:
      the empty ImportInfo object.
    • imports

      public ImportInfo imports()
      Description copied from interface: ImportsSupplier
      Gets the imports.
      Specified by:
      imports in interface ImportsSupplier
      Returns:
      the imports.
    • withAddedNormalImport

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

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

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

      public ImportInfo withAddedImports(Collection<? extends ImportsSupplier> importSuppliers)
      Returns a new ImportInfo object with all imports from specified suppliers added.
      Parameters:
      importSuppliers - the imports to add.
      Returns:
      the new and updated ImportInfo 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.
    • normalImports

      public Set<String> normalImports()
      Returns the value of the normalImports record component.
      Returns:
      the value of the normalImports record component
    • staticImports

      public Set<String> staticImports()
      Returns the value of the staticImports record component.
      Returns:
      the value of the staticImports record component