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 classSMFSchemaIdentifier.BuilderBuilds instances of typeSMFSchemaIdentifier.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SMFSchemaIdentifier.Builderbuilder()Creates a builder forSMFSchemaIdentifier.static SMFSchemaIdentifiercopyOf(SMFSchemaIdentifierType instance)Creates an immutable copy of aSMFSchemaIdentifierTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofSMFSchemaIdentifierthat have equal attribute values.inthashCode()Computes a hash code from attributes:name,versionMajor,versionMinor.SMFSchemaNamename()static SMFSchemaIdentifierof(SMFSchemaName name, int versionMajor, int versionMinor)Construct a new immutableSMFSchemaIdentifierinstance.java.lang.StringtoHumanString()java.lang.StringtoString()Prints the immutable valueSMFSchemaIdentifierwith attribute values.intversionMajor()intversionMinor()SMFSchemaIdentifierwithName(SMFSchemaName value)Copy the current immutable object by setting a value for thenameattribute.SMFSchemaIdentifierwithVersionMajor(int value)Copy the current immutable object by setting a value for theversionMajorattribute.SMFSchemaIdentifierwithVersionMinor(int value)Copy the current immutable object by setting a value for theversionMinorattribute.
-
-
-
Method Detail
-
name
public SMFSchemaName name()
- Specified by:
namein interfaceSMFSchemaIdentifierType- Returns:
- The schema name
-
versionMajor
public int versionMajor()
- Specified by:
versionMajorin interfaceSMFSchemaIdentifierType- Returns:
- The schema major version
-
versionMinor
public int versionMinor()
- Specified by:
versionMinorin interfaceSMFSchemaIdentifierType- Returns:
- The schema minor version
-
withName
public final SMFSchemaIdentifier withName(SMFSchemaName value)
Copy the current immutable object by setting a value for thenameattribute. 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
thisobject
-
withVersionMajor
public final SMFSchemaIdentifier withVersionMajor(int value)
Copy the current immutable object by setting a value for theversionMajorattribute. 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
thisobject
-
withVersionMinor
public final SMFSchemaIdentifier withVersionMinor(int value)
Copy the current immutable object by setting a value for theversionMinorattribute. 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
thisobject
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofSMFSchemaIdentifierthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:name,versionMajor,versionMinor.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueSMFSchemaIdentifierwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
toHumanString
public java.lang.String toHumanString()
Returns a lazily initialized value of the
toHumanStringattribute. 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:
toHumanStringin interfaceSMFSchemaIdentifierType- Returns:
- A lazily initialized value of the
toHumanStringattribute
-
of
public static SMFSchemaIdentifier of(SMFSchemaName name, int versionMajor, int versionMinor)
Construct a new immutableSMFSchemaIdentifierinstance.- Parameters:
name- The value for thenameattributeversionMajor- The value for theversionMajorattributeversionMinor- The value for theversionMinorattribute- Returns:
- An immutable SMFSchemaIdentifier instance
-
copyOf
public static SMFSchemaIdentifier copyOf(SMFSchemaIdentifierType instance)
Creates an immutable copy of aSMFSchemaIdentifierTypevalue. 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) // requiredname.setVersionMajor(int) // optionalversionMajor.setVersionMinor(int) // optionalversionMinor.build();- Returns:
- A new SMFSchemaIdentifier builder
-
-