Package com.io7m.waxmill.process.api
Class WXMProcessDescription
java.lang.Object
com.io7m.waxmill.process.api.WXMProcessDescription
- All Implemented Interfaces:
WXMProcessDescriptionType
public final class WXMProcessDescription extends java.lang.Object implements WXMProcessDescriptionType
A description of a process to be created.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWXMProcessDescription.BuilderBuilds instances of typeWXMProcessDescription. -
Method Summary
Modifier and Type Method Description java.util.List<java.lang.String>arguments()static WXMProcessDescription.Builderbuilder()Creates a builder forWXMProcessDescription.static WXMProcessDescriptioncopyOf(WXMProcessDescriptionType instance)Creates an immutable copy of aWXMProcessDescriptionTypevalue.java.util.Map<java.lang.String,java.lang.String>environment()booleanequals(java.lang.Object another)This instance is equal to all instances ofWXMProcessDescriptionthat have equal attribute values.java.nio.file.Pathexecutable()inthashCode()Computes a hash code from attributes:executable,arguments,environment.java.lang.StringtoString()Prints the immutable valueWXMProcessDescriptionwith attribute values.WXMProcessDescriptionwithArguments(java.lang.Iterable<java.lang.String> elements)Copy the current immutable object with elements that replace the content ofarguments.WXMProcessDescriptionwithArguments(java.lang.String... elements)Copy the current immutable object with elements that replace the content ofarguments.WXMProcessDescriptionwithEnvironment(java.util.Map<java.lang.String,? extends java.lang.String> entries)Copy the current immutable object by replacing theenvironmentmap with the specified map.WXMProcessDescriptionwithExecutable(java.nio.file.Path value)Copy the current immutable object by setting a value for theexecutableattribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.io7m.waxmill.process.api.WXMProcessDescriptionType
checkPreconditions
-
Method Details
-
executable
public java.nio.file.Path executable()- Specified by:
executablein interfaceWXMProcessDescriptionType- Returns:
- The full path to the executable
-
arguments
public java.util.List<java.lang.String> arguments()- Specified by:
argumentsin interfaceWXMProcessDescriptionType- Returns:
- The list of arguments passed to the executable
-
environment
public java.util.Map<java.lang.String,java.lang.String> environment()- Specified by:
environmentin interfaceWXMProcessDescriptionType- Returns:
- The environment that the new process will use
-
withExecutable
Copy the current immutable object by setting a value for theexecutableattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for executable- Returns:
- A modified copy of the
thisobject
-
withArguments
Copy the current immutable object with elements that replace the content ofarguments.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withArguments
Copy the current immutable object with elements that replace the content ofarguments. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of arguments elements to set- Returns:
- A modified copy of
thisobject
-
withEnvironment
public final WXMProcessDescription withEnvironment(java.util.Map<java.lang.String,? extends java.lang.String> entries)Copy the current immutable object by replacing theenvironmentmap with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
entries- The entries to be added to the environment map- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(java.lang.Object another)This instance is equal to all instances ofWXMProcessDescriptionthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()Computes a hash code from attributes:executable,arguments,environment.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()Prints the immutable valueWXMProcessDescriptionwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
Creates an immutable copy of aWXMProcessDescriptionTypevalue. 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 WXMProcessDescription instance
-
builder
Creates a builder forWXMProcessDescription.WXMProcessDescription.builder() .setExecutable(java.nio.file.Path) // requiredexecutable.addArguments|addAllArguments(String) //argumentselements .putEnvironment|putAllEnvironment(String => String) //environmentmappings .build();- Returns:
- A new WXMProcessDescription builder
-