Package com.io7m.smfj.core
Class SMFFormatVersionMutable
- java.lang.Object
-
- com.io7m.smfj.core.SMFFormatVersionMutable
-
- All Implemented Interfaces:
SMFFormatVersionType
,java.lang.Comparable<SMFFormatVersionType>
public final class SMFFormatVersionMutable extends java.lang.Object implements SMFFormatVersionType
A modifiable implementation of theSMFFormatVersionType
type.Use the
create()
static factory methods to create new instances. Use thetoImmutable()
method to convert to canonical immutable instances.SMFFormatVersionMutable is not thread-safe
- See Also:
SMFFormatVersion
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SMFFormatVersionMutable
clear()
Clears the object by setting all attributes to their initial values.static SMFFormatVersionMutable
create()
Construct a modifiable instance ofSMFFormatVersionType
.static SMFFormatVersionMutable
create(int major, int minor)
Construct a modifiable instance ofSMFFormatVersionType
.boolean
equals(java.lang.Object another)
This instance is equal to all instances ofSMFFormatVersionMutable
that have equal attribute values.SMFFormatVersionMutable
from(SMFFormatVersionMutable instance)
Fill this modifiable instance with attribute values from the providedSMFFormatVersionType
instance.SMFFormatVersionMutable
from(SMFFormatVersionType instance)
Fill this modifiable instance with attribute values from the providedSMFFormatVersionType
instance.int
hashCode()
Computes a hash code from attributes:major
,minor
.boolean
isInitialized()
Returnstrue
if all required attributes are set, indicating that the object is initialized.int
major()
boolean
majorIsSet()
Returnstrue
if the required attributemajor
is set.int
minor()
boolean
minorIsSet()
Returnstrue
if the required attributeminor
is set.SMFFormatVersionMutable
setMajor(int major)
Assigns a value to themajor
attribute.SMFFormatVersionMutable
setMinor(int minor)
Assigns a value to theminor
attribute.SMFFormatVersion
toImmutable()
Converts toSMFFormatVersion
.java.lang.String
toString()
Generates a string representation of thisSMFFormatVersionType
.SMFFormatVersionMutable
unsetMajor()
Reset an attribute to its initial value.SMFFormatVersionMutable
unsetMinor()
Reset an attribute to its initial value.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.io7m.smfj.core.SMFFormatVersionType
compareTo, toHumanString
-
-
-
-
Method Detail
-
create
public static SMFFormatVersionMutable create(int major, int minor)
Construct a modifiable instance ofSMFFormatVersionType
.
-
create
public static SMFFormatVersionMutable create()
Construct a modifiable instance ofSMFFormatVersionType
.- Returns:
- A new modifiable instance
-
major
public final int major()
- Specified by:
major
in interfaceSMFFormatVersionType
- Returns:
- The major number for a format
-
minor
public final int minor()
- Specified by:
minor
in interfaceSMFFormatVersionType
- Returns:
- The minor number for a format
-
clear
public SMFFormatVersionMutable clear()
Clears the object by setting all attributes to their initial values.- Returns:
this
for use in a chained invocation
-
from
public SMFFormatVersionMutable from(SMFFormatVersionType instance)
Fill this modifiable instance with attribute values from the providedSMFFormatVersionType
instance. Regular attribute values will be overridden, i.e. replaced with ones of an instance. Any of the instance's absent optional values will not be copied (will not override current values).- Parameters:
instance
- The instance from which to copy values- Returns:
this
for use in a chained invocation
-
from
public SMFFormatVersionMutable from(SMFFormatVersionMutable instance)
Fill this modifiable instance with attribute values from the providedSMFFormatVersionType
instance. Regular attribute values will be overridden, i.e. replaced with ones of an instance. Any of the instance's absent optional values will not be copied (will not override current values).- Parameters:
instance
- The instance from which to copy values- Returns:
this
for use in a chained invocation
-
setMajor
public SMFFormatVersionMutable setMajor(int major)
Assigns a value to themajor
attribute.- Parameters:
major
- The value for major- Returns:
this
for use in a chained invocation
-
setMinor
public SMFFormatVersionMutable setMinor(int minor)
Assigns a value to theminor
attribute.- Parameters:
minor
- The value for minor- Returns:
this
for use in a chained invocation
-
majorIsSet
public final boolean majorIsSet()
Returnstrue
if the required attributemajor
is set.- Returns:
true
if set
-
minorIsSet
public final boolean minorIsSet()
Returnstrue
if the required attributeminor
is set.- Returns:
true
if set
-
unsetMajor
public final SMFFormatVersionMutable unsetMajor()
Reset an attribute to its initial value.- Returns:
this
for use in a chained invocation
-
unsetMinor
public final SMFFormatVersionMutable unsetMinor()
Reset an attribute to its initial value.- Returns:
this
for use in a chained invocation
-
isInitialized
public final boolean isInitialized()
Returnstrue
if all required attributes are set, indicating that the object is initialized.- Returns:
true
if set
-
toImmutable
public final SMFFormatVersion toImmutable()
Converts toSMFFormatVersion
.- Returns:
- An immutable instance of SMFFormatVersion
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofSMFFormatVersionMutable
that have equal attribute values. An uninitialized instance is equal only to itself.- Overrides:
equals
in classjava.lang.Object
- Returns:
true
ifthis
is equal toanother
instance
-
hashCode
public int hashCode()
Computes a hash code from attributes:major
,minor
.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Generates a string representation of thisSMFFormatVersionType
. If uninitialized, some attribute values may appear as question marks.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation
-
-