Package com.io7m.waxmill.xml.config.v1
Class WXM1Path
java.lang.Object
com.io7m.waxmill.xml.config.v1.WXM1Path
- All Implemented Interfaces:
WXM1PathType
public final class WXM1Path extends java.lang.Object implements WXM1PathType
Immutable implementation of
WXM1PathType.
Use the builder to create immutable instances:
WXM1Path.builder().
Use the static factory method to create immutable instances:
WXM1Path.of().
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWXM1Path.BuilderBuilds instances of typeWXM1Path. -
Method Summary
Modifier and Type Method Description static WXM1Path.Builderbuilder()Creates a builder forWXM1Path.static WXM1PathcopyOf(WXM1PathType instance)Creates an immutable copy of aWXM1PathTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofWXM1Paththat have equal attribute values.inthashCode()Computes a hash code from attributes:type,path.static WXM1Pathof(java.lang.String type, java.nio.file.Path path)Construct a new immutableWXM1Pathinstance.java.nio.file.Pathpath()java.lang.StringtoString()Prints the immutable valueWXM1Pathwith attribute values.java.lang.Stringtype()WXM1PathwithPath(java.nio.file.Path value)Copy the current immutable object by setting a value for thepathattribute.WXM1PathwithType(java.lang.String value)Copy the current immutable object by setting a value for thetypeattribute.
-
Method Details
-
type
public java.lang.String type()- Specified by:
typein interfaceWXM1PathType- Returns:
- The value of the
typeattribute
-
path
public java.nio.file.Path path()- Specified by:
pathin interfaceWXM1PathType- Returns:
- The value of the
pathattribute
-
withType
Copy the current immutable object by setting a value for thetypeattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for type- Returns:
- A modified copy of the
thisobject
-
withPath
Copy the current immutable object by setting a value for thepathattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for path- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(java.lang.Object another)This instance is equal to all instances ofWXM1Paththat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()Computes a hash code from attributes:type,path.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()Prints the immutable valueWXM1Pathwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
Construct a new immutableWXM1Pathinstance.- Parameters:
type- The value for thetypeattributepath- The value for thepathattribute- Returns:
- An immutable WXM1Path instance
-
copyOf
Creates an immutable copy of aWXM1PathTypevalue. 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 WXM1Path instance
-
builder
Creates a builder forWXM1Path.WXM1Path.builder() .setType(String) // requiredtype.setPath(java.nio.file.Path) // requiredpath.build();- Returns:
- A new WXM1Path builder
-