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 class
SMFFilterCommandContext.Builder
Builds instances of typeSMFFilterCommandContext
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SMFFilterCommandContext.Builder
builder()
Creates a builder forSMFFilterCommandContext
.static SMFFilterCommandContext
copyOf(SMFFilterCommandContextType instance)
Creates an immutable copy of aSMFFilterCommandContextType
value.java.nio.file.Path
currentPath()
The current path.boolean
equals(java.lang.Object another)
This instance is equal to all instances ofSMFFilterCommandContext
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:sourceRoot
,currentPath
.static SMFFilterCommandContext
of(java.nio.file.Path sourceRoot, java.nio.file.Path currentPath)
Construct a new immutableSMFFilterCommandContext
instance.java.nio.file.Path
sourceRoot()
The source root directory.java.lang.String
toString()
Prints the immutable valueSMFFilterCommandContext
with attribute values.SMFFilterCommandContext
withCurrentPath(java.nio.file.Path value)
Copy the current immutable object by setting a value for thecurrentPath
attribute.SMFFilterCommandContext
withSourceRoot(java.nio.file.Path value)
Copy the current immutable object by setting a value for thesourceRoot
attribute.-
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:
sourceRoot
in 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:
currentPath
in 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 thesourceRoot
attribute. 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
this
object
-
withCurrentPath
public final SMFFilterCommandContext withCurrentPath(java.nio.file.Path value)
Copy the current immutable object by setting a value for thecurrentPath
attribute. 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
this
object
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofSMFFilterCommandContext
that have equal attribute values.- Overrides:
equals
in classjava.lang.Object
- Returns:
true
ifthis
is equal toanother
instance
-
hashCode
public int hashCode()
Computes a hash code from attributes:sourceRoot
,currentPath
.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueSMFFilterCommandContext
with attribute values.- Overrides:
toString
in 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 immutableSMFFilterCommandContext
instance.- Parameters:
sourceRoot
- The value for thesourceRoot
attributecurrentPath
- The value for thecurrentPath
attribute- Returns:
- An immutable SMFFilterCommandContext instance
-
copyOf
public static SMFFilterCommandContext copyOf(SMFFilterCommandContextType instance)
Creates an immutable copy of aSMFFilterCommandContextType
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 SMFFilterCommandContext instance
-
builder
public static SMFFilterCommandContext.Builder builder()
Creates a builder forSMFFilterCommandContext
.SMFFilterCommandContext.builder() .setSourceRoot(java.nio.file.Path) // required
sourceRoot
.setCurrentPath(java.nio.file.Path) // requiredcurrentPath
.build();- Returns:
- A new SMFFilterCommandContext builder
-
-