Record Class MethodInfo

java.lang.Object
java.lang.Record
io.github.torand.openapi2java.model.MethodInfo
Record Components:
name - the method name.
parameters - the method parameters.
returnType - the method return type.
deprecationMessage - the deprecation message, if any.
annotations - the annotations decorating this method.
All Implemented Interfaces:
EntityInfo

public record MethodInfo(String name, List<MethodParamInfo> parameters, String returnType, String deprecationMessage, List<AnnotationInfo> annotations) extends Record implements EntityInfo
Describes a method.
  • Constructor Details

    • MethodInfo

      public MethodInfo(String name)
      Constructs a MethodInfo object.
      Parameters:
      name - the method name.
    • MethodInfo

      public MethodInfo(String name, List<MethodParamInfo> parameters, String returnType, String deprecationMessage, List<AnnotationInfo> annotations)
      Creates an instance of a MethodInfo record class.
      Parameters:
      name - the value for the name record component
      parameters - the value for the parameters record component
      returnType - the value for the returnType record component
      deprecationMessage - the value for the deprecationMessage record component
      annotations - the value for the annotations record component
  • Method Details

    • withAddedParameters

      public MethodInfo withAddedParameters(Collection<MethodParamInfo> params)
      Returns a new MethodInfo object with specified parameters added.
      Parameters:
      params - the parameters to add.
      Returns:
      the new and updated MethodInfo object.
    • withReturnType

      public MethodInfo withReturnType(String returnType)
      Returns a new MethodInfo object with specified return type.
      Parameters:
      returnType - the return type.
      Returns:
      the new and updated MethodInfo object.
    • withDeprecationMessage

      public MethodInfo withDeprecationMessage(String deprecationMessage)
      Returns a new MethodInfo object with specified deprecation message.
      Parameters:
      deprecationMessage - the deprecation message.
      Returns:
      the new and updated MethodInfo object.
    • withAddedAnnotation

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

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

      public boolean isDeprecated()
      Indicates whether the method is deprecated.
      Returns:
      true if method is deprecated; 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
    • parameters

      public List<MethodParamInfo> parameters()
      Returns the value of the parameters record component.
      Returns:
      the value of the parameters record component
    • returnType

      public String returnType()
      Returns the value of the returnType record component.
      Returns:
      the value of the returnType record component
    • deprecationMessage

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