Record Class InputFileDTO

java.lang.Object
java.lang.Record
io.github.yvasyliev.telegramforwarderbot.dto.InputFileDTO
Record Components:
fileSupplier - a supplier for the input stream of the file
filename - the name of the file
hasSpoiler - indicates if the file has a spoiler

public record InputFileDTO(InputStreamSupplier fileSupplier, String filename, boolean hasSpoiler) extends Record
Data Transfer Object for input files.
  • Constructor Details

    • InputFileDTO

      public InputFileDTO(InputStreamSupplier fileSupplier, String filename, boolean hasSpoiler)
      Creates an instance of a InputFileDTO record class.
      Parameters:
      fileSupplier - the value for the fileSupplier record component
      filename - the value for the filename record component
      hasSpoiler - the value for the hasSpoiler record component
  • Method Details

    • fromUrl

      public static InputFileDTO fromUrl(URL url, boolean hasSpoiler)
      Creates an InputFileDTO from a URL.
      Parameters:
      url - the URL of the file
      hasSpoiler - indicates if the file has a spoiler
      Returns:
      a new InputFileDTO instance
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • fileSupplier

      public InputStreamSupplier fileSupplier()
      Returns the value of the fileSupplier record component.
      Returns:
      the value of the fileSupplier record component
    • filename

      public String filename()
      Returns the value of the filename record component.
      Returns:
      the value of the filename record component
    • hasSpoiler

      public boolean hasSpoiler()
      Returns the value of the hasSpoiler record component.
      Returns:
      the value of the hasSpoiler record component