public final class ImmutableNumericVersion extends Object implements NumericVersion
NumericVersion.
Use the builder to create immutable instances:
ImmutableNumericVersion.builder().
Use the static factory method to create immutable instances:
ImmutableNumericVersion.of().
| Modifier and Type | Class and Description |
|---|---|
static class |
ImmutableNumericVersion.Builder
Builds instances of type
ImmutableNumericVersion. |
| Modifier and Type | Method and Description |
|---|---|
static ImmutableNumericVersion.Builder |
builder()
Creates a builder for
ImmutableNumericVersion. |
static ImmutableNumericVersion |
copyOf(NumericVersion instance)
Creates an immutable copy of a
NumericVersion value. |
boolean |
equals(Object another)
This instance is equal to all instances of
ImmutableNumericVersion that have equal attribute values. |
int |
hashCode()
Computes a hash code from attributes:
major, minor, patch. |
int |
major() |
int |
minor() |
static ImmutableNumericVersion |
of(int major,
int minor,
int patch)
Construct a new immutable
NumericVersion instance. |
int |
patch() |
String |
toString()
Prints the immutable value
NumericVersion with attribute values. |
ImmutableNumericVersion |
withMajor(int value)
Copy the current immutable object by setting a value for the
major attribute. |
ImmutableNumericVersion |
withMinor(int value)
Copy the current immutable object by setting a value for the
minor attribute. |
ImmutableNumericVersion |
withPatch(int value)
Copy the current immutable object by setting a value for the
patch attribute. |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitisNewerOrEqual, isNewerOrEqual, isNextOrPrevPatch, isOlderOrEqual, isOlderOrEqual, ofpublic int major()
major in interface NumericVersionmajor attributepublic int minor()
minor in interface NumericVersionminor attributepublic int patch()
patch in interface NumericVersionpatch attributepublic final ImmutableNumericVersion withMajor(int value)
major attribute.
A value equality check is used to prevent copying of the same value by returning this.value - A new value for majorthis objectpublic final ImmutableNumericVersion withMinor(int value)
minor attribute.
A value equality check is used to prevent copying of the same value by returning this.value - A new value for minorthis objectpublic final ImmutableNumericVersion withPatch(int value)
patch attribute.
A value equality check is used to prevent copying of the same value by returning this.value - A new value for patchthis objectpublic boolean equals(Object another)
ImmutableNumericVersion that have equal attribute values.public int hashCode()
major, minor, patch.public String toString()
NumericVersion with attribute values.public static ImmutableNumericVersion of(int major, int minor, int patch)
NumericVersion instance.of in interface NumericVersionmajor - The value for the major attributeminor - The value for the minor attributepatch - The value for the patch attributepublic static ImmutableNumericVersion copyOf(NumericVersion instance)
NumericVersion value.
Uses accessors to get values to initialize the new immutable instance.
If an instance is already immutable, it is returned as is.instance - The instance to copypublic static ImmutableNumericVersion.Builder builder()
ImmutableNumericVersion.
ImmutableNumericVersion.builder()
.major(int) // required major
.minor(int) // required minor
.patch(int) // required patch
.build();
Copyright © 2021. All rights reserved.