Record Class ResourceInfo

java.lang.Object
java.lang.Record
io.github.torand.openapi2java.model.ResourceInfo
Record Components:
name - the resource name.
imports - the imports required by the resource.
annotations - the annotations decorating this resource.
methods - the methods of this resource.
All Implemented Interfaces:
EntityInfo, ImportsSupplier

public record ResourceInfo(String name, ImportInfo imports, List<AnnotationInfo> annotations, List<MethodInfo> methods) extends Record implements EntityInfo, ImportsSupplier
Describes a resource.
  • Constructor Details

    • ResourceInfo

      public ResourceInfo(String name)
      Constructs a ResourceInfo object.
      Parameters:
      name - the resource name.
    • ResourceInfo

      public ResourceInfo(String name, ImportInfo imports, List<AnnotationInfo> annotations, List<MethodInfo> methods)
      Creates an instance of a ResourceInfo record class.
      Parameters:
      name - the value for the name record component
      imports - the value for the imports record component
      annotations - the value for the annotations record component
      methods - the value for the methods record component
  • Method Details

    • withAddedNormalImport

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

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

      public ResourceInfo withAddedAnnotations(Collection<AnnotationInfo> annotations)
      Returns a new ResourceInfo object with specified annotations added.
      Parameters:
      annotations - the annotations to add.
      Returns:
      the new and updated ResourceInfo object.
    • withAddedMethod

      public ResourceInfo withAddedMethod(MethodInfo method)
      Returns a new ResourceInfo object with specified method added.
      Parameters:
      method - the method to add.
      Returns:
      the new and updated ResourceInfo object.
    • isEmpty

      public boolean isEmpty()
      Gets whether resource has no methods.
      Returns:
      true if resource has no methods; else false.
    • 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. 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.
    • name

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

      public List<MethodInfo> methods()
      Returns the value of the methods record component.
      Returns:
      the value of the methods record component