Package com.io7m.smfj.processing.api
Class SMFFilterCommandContext
- java.lang.Object
-
- com.io7m.smfj.processing.api.SMFFilterCommandContext
-
- All Implemented Interfaces:
SMFFilterCommandContextType
public final class SMFFilterCommandContext extends java.lang.Object implements SMFFilterCommandContextType
The context used during filtering.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSMFFilterCommandContext.BuilderBuilds instances of typeSMFFilterCommandContext.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SMFFilterCommandContext.Builderbuilder()Creates a builder forSMFFilterCommandContext.static SMFFilterCommandContextcopyOf(SMFFilterCommandContextType instance)Creates an immutable copy of aSMFFilterCommandContextTypevalue.java.nio.file.PathcurrentPath()The current path.booleanequals(java.lang.Object another)This instance is equal to all instances ofSMFFilterCommandContextthat have equal attribute values.inthashCode()Computes a hash code from attributes:sourceRoot,currentPath.static SMFFilterCommandContextof(java.nio.file.Path sourceRoot, java.nio.file.Path currentPath)Construct a new immutableSMFFilterCommandContextinstance.java.nio.file.PathsourceRoot()The source root directory.java.lang.StringtoString()Prints the immutable valueSMFFilterCommandContextwith attribute values.SMFFilterCommandContextwithCurrentPath(java.nio.file.Path value)Copy the current immutable object by setting a value for thecurrentPathattribute.SMFFilterCommandContextwithSourceRoot(java.nio.file.Path value)Copy the current immutable object by setting a value for thesourceRootattribute.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.io7m.smfj.processing.api.SMFFilterCommandContextType
checkPreconditions, resolvePath
-
-
-
-
Method Detail
-
sourceRoot
public java.nio.file.Path sourceRoot()
The source root directory. If a filter causes files to be open, they must be descendants of this directory.- Specified by:
sourceRootin interfaceSMFFilterCommandContextType- Returns:
- A source root directory
-
currentPath
public java.nio.file.Path currentPath()
The current path. If a filter command specifies a relative path, the path is resolved relative to the current path.- Specified by:
currentPathin interfaceSMFFilterCommandContextType- Returns:
- The current path
- See Also:
SMFFilterCommandContextType.resolvePath(Path)
-
withSourceRoot
public final SMFFilterCommandContext withSourceRoot(java.nio.file.Path value)
Copy the current immutable object by setting a value for thesourceRootattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for sourceRoot- Returns:
- A modified copy of the
thisobject
-
withCurrentPath
public final SMFFilterCommandContext withCurrentPath(java.nio.file.Path value)
Copy the current immutable object by setting a value for thecurrentPathattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for currentPath- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofSMFFilterCommandContextthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:sourceRoot,currentPath.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueSMFFilterCommandContextwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
public static SMFFilterCommandContext of(java.nio.file.Path sourceRoot, java.nio.file.Path currentPath)
Construct a new immutableSMFFilterCommandContextinstance.- Parameters:
sourceRoot- The value for thesourceRootattributecurrentPath- The value for thecurrentPathattribute- Returns:
- An immutable SMFFilterCommandContext instance
-
copyOf
public static SMFFilterCommandContext copyOf(SMFFilterCommandContextType instance)
Creates an immutable copy of aSMFFilterCommandContextTypevalue. 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 SMFFilterCommandContext instance
-
builder
public static SMFFilterCommandContext.Builder builder()
Creates a builder forSMFFilterCommandContext.SMFFilterCommandContext.builder() .setSourceRoot(java.nio.file.Path) // requiredsourceRoot.setCurrentPath(java.nio.file.Path) // requiredcurrentPath.build();- Returns:
- A new SMFFilterCommandContext builder
-
-