Package com.io7m.smfj.core
Class SMFSchemaIdentifier
- java.lang.Object
-
- com.io7m.smfj.core.SMFSchemaIdentifier
-
- All Implemented Interfaces:
SMFSchemaIdentifierType
public final class SMFSchemaIdentifier extends java.lang.Object implements SMFSchemaIdentifierType
A schema identifier.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SMFSchemaIdentifier.Builder
Builds instances of typeSMFSchemaIdentifier
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SMFSchemaIdentifier.Builder
builder()
Creates a builder forSMFSchemaIdentifier
.static SMFSchemaIdentifier
copyOf(SMFSchemaIdentifierType instance)
Creates an immutable copy of aSMFSchemaIdentifierType
value.boolean
equals(java.lang.Object another)
This instance is equal to all instances ofSMFSchemaIdentifier
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:name
,versionMajor
,versionMinor
.SMFSchemaName
name()
static SMFSchemaIdentifier
of(SMFSchemaName name, int versionMajor, int versionMinor)
Construct a new immutableSMFSchemaIdentifier
instance.java.lang.String
toHumanString()
java.lang.String
toString()
Prints the immutable valueSMFSchemaIdentifier
with attribute values.int
versionMajor()
int
versionMinor()
SMFSchemaIdentifier
withName(SMFSchemaName value)
Copy the current immutable object by setting a value for thename
attribute.SMFSchemaIdentifier
withVersionMajor(int value)
Copy the current immutable object by setting a value for theversionMajor
attribute.SMFSchemaIdentifier
withVersionMinor(int value)
Copy the current immutable object by setting a value for theversionMinor
attribute.
-
-
-
Method Detail
-
name
public SMFSchemaName name()
- Specified by:
name
in interfaceSMFSchemaIdentifierType
- Returns:
- The schema name
-
versionMajor
public int versionMajor()
- Specified by:
versionMajor
in interfaceSMFSchemaIdentifierType
- Returns:
- The schema major version
-
versionMinor
public int versionMinor()
- Specified by:
versionMinor
in interfaceSMFSchemaIdentifierType
- Returns:
- The schema minor version
-
withName
public final SMFSchemaIdentifier withName(SMFSchemaName value)
Copy the current immutable object by setting a value for thename
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for name- Returns:
- A modified copy of the
this
object
-
withVersionMajor
public final SMFSchemaIdentifier withVersionMajor(int value)
Copy the current immutable object by setting a value for theversionMajor
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for versionMajor- Returns:
- A modified copy of the
this
object
-
withVersionMinor
public final SMFSchemaIdentifier withVersionMinor(int value)
Copy the current immutable object by setting a value for theversionMinor
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for versionMinor- Returns:
- A modified copy of the
this
object
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofSMFSchemaIdentifier
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:name
,versionMajor
,versionMinor
.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueSMFSchemaIdentifier
with attribute values.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of the value
-
toHumanString
public java.lang.String toHumanString()
Returns a lazily initialized value of the
toHumanString
attribute. Initialized once and only once and stored for subsequent access with proper synchronization. In case of any exception or error thrown by the lazy value initializer, the result will not be memoised (i.e. remembered) and on next call computation will be attempted again.- Specified by:
toHumanString
in interfaceSMFSchemaIdentifierType
- Returns:
- A lazily initialized value of the
toHumanString
attribute
-
of
public static SMFSchemaIdentifier of(SMFSchemaName name, int versionMajor, int versionMinor)
Construct a new immutableSMFSchemaIdentifier
instance.- Parameters:
name
- The value for thename
attributeversionMajor
- The value for theversionMajor
attributeversionMinor
- The value for theversionMinor
attribute- Returns:
- An immutable SMFSchemaIdentifier instance
-
copyOf
public static SMFSchemaIdentifier copyOf(SMFSchemaIdentifierType instance)
Creates an immutable copy of aSMFSchemaIdentifierType
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 SMFSchemaIdentifier instance
-
builder
public static SMFSchemaIdentifier.Builder builder()
Creates a builder forSMFSchemaIdentifier
.SMFSchemaIdentifier.builder() .setName(com.io7m.smfj.core.SMFSchemaName) // required
name
.setVersionMajor(int) // optionalversionMajor
.setVersionMinor(int) // optionalversionMinor
.build();- Returns:
- A new SMFSchemaIdentifier builder
-
-