Class SPIParserRequest

java.lang.Object
com.io7m.coffeepick.runtime.parser.spi.SPIParserRequest
All Implemented Interfaces:
SPIParserRequestType

public final class SPIParserRequest
extends java.lang.Object
implements SPIParserRequestType
A parser request.
  • Method Details

    • file

      public java.net.URI file()
      Specified by:
      file in interface SPIParserRequestType
      Returns:
      The URI of the file, for diagnostic purposes
    • stream

      public java.io.InputStream stream()
      Specified by:
      stream in interface SPIParserRequestType
      Returns:
      An open input stream of the file to be parsed
    • withFile

      public final SPIParserRequest withFile​(java.net.URI value)
      Copy the current immutable object by setting a value for the file attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for file
      Returns:
      A modified copy of the this object
    • withStream

      public final SPIParserRequest withStream​(java.io.InputStream value)
      Copy the current immutable object by setting a value for the stream attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for stream
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals​(java.lang.Object another)
      This instance is equal to all instances of SPIParserRequest that have equal attribute values.
      Overrides:
      equals in class java.lang.Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: file, stream.
      Overrides:
      hashCode in class java.lang.Object
      Returns:
      hashCode value
    • toString

      public java.lang.String toString()
      Prints the immutable value SPIParserRequest with attribute values.
      Overrides:
      toString in class java.lang.Object
      Returns:
      A string representation of the value
    • copyOf

      public static SPIParserRequest copyOf​(SPIParserRequestType instance)
      Creates an immutable copy of a SPIParserRequestType value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable SPIParserRequest instance
    • builder

      public static SPIParserRequest.Builder builder()
      Creates a builder for SPIParserRequest.
       SPIParserRequest.builder()
          .setFile(java.net.URI) // required file
          .setStream(java.io.InputStream) // required stream
          .build();
       
      Returns:
      A new SPIParserRequest builder