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.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSPIParserRequest.BuilderBuilds instances of typeSPIParserRequest. -
Method Summary
Modifier and Type Method Description static SPIParserRequest.Builderbuilder()Creates a builder forSPIParserRequest.static SPIParserRequestcopyOf(SPIParserRequestType instance)Creates an immutable copy of aSPIParserRequestTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofSPIParserRequestthat have equal attribute values.java.net.URIfile()inthashCode()Computes a hash code from attributes:file,stream.java.io.InputStreamstream()java.lang.StringtoString()Prints the immutable valueSPIParserRequestwith attribute values.SPIParserRequestwithFile(java.net.URI value)Copy the current immutable object by setting a value for thefileattribute.SPIParserRequestwithStream(java.io.InputStream value)Copy the current immutable object by setting a value for thestreamattribute.
-
Method Details
-
file
public java.net.URI file()- Specified by:
filein interfaceSPIParserRequestType- Returns:
- The URI of the file, for diagnostic purposes
-
stream
public java.io.InputStream stream()- Specified by:
streamin interfaceSPIParserRequestType- Returns:
- An open input stream of the file to be parsed
-
withFile
Copy the current immutable object by setting a value for thefileattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for file- Returns:
- A modified copy of the
thisobject
-
withStream
Copy the current immutable object by setting a value for thestreamattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for stream- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(java.lang.Object another)This instance is equal to all instances ofSPIParserRequestthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()Computes a hash code from attributes:file,stream.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()Prints the immutable valueSPIParserRequestwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
Creates an immutable copy of aSPIParserRequestTypevalue. 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
Creates a builder forSPIParserRequest.SPIParserRequest.builder() .setFile(java.net.URI) // requiredfile.setStream(java.io.InputStream) // requiredstream.build();- Returns:
- A new SPIParserRequest builder
-