Class MetadataVersion
java.lang.Object
com.github.zafarkhaja.semver.MetadataVersion
- All Implemented Interfaces:
Comparable<MetadataVersion>
- Direct Known Subclasses:
MetadataVersion.NullMetadataVersion
The
MetadataVersion class is used to represent
the pre-release version and the build metadata.- Since:
- 0.2.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classThe implementation of the Null Object design pattern. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String[]The array containing the version's identifiers.(package private) static final MetadataVersionNull metadata, the implementation of the Null Object design pattern. -
Constructor Summary
ConstructorsConstructorDescriptionMetadataVersion(String[] identifiers) Constructs aMetadataVersioninstance with identifiers. -
Method Summary
Modifier and TypeMethodDescriptionprivate intcompareIdentifierArrays(String[] otherIdents) Compares two arrays of identifiers.private intcompareIdentifiers(String ident1, String ident2) Compares two identifiers.intcompareTo(MetadataVersion other) booleanprivate intgetLeastCommonArrayLength(String[] arr1, String[] arr2) Returns the size of the smallest array.inthashCode()(package private) MetadataVersionIncrements the metadata version.private booleanChecks if the specified string is an integer.toString()
-
Field Details
-
NULL
Null metadata, the implementation of the Null Object design pattern. -
idents
The array containing the version's identifiers.
-
-
Constructor Details
-
MetadataVersion
MetadataVersion(String[] identifiers) Constructs aMetadataVersioninstance with identifiers.- Parameters:
identifiers- the version's identifiers
-
-
Method Details
-
increment
MetadataVersion increment()Increments the metadata version.- Returns:
- a new instance of the
MetadataVersionclass
-
equals
-
hashCode
-
toString
-
compareTo
- Specified by:
compareToin interfaceComparable<MetadataVersion>
-
compareIdentifierArrays
Compares two arrays of identifiers.- Parameters:
otherIdents- the identifiers of the other version- Returns:
- integer result of comparison compatible with
the
Comparable.compareTomethod
-
getLeastCommonArrayLength
-
compareIdentifiers
-
isInt
Checks if the specified string is an integer.- Parameters:
str- the string to check- Returns:
trueif the specified string is an integer orfalseotherwise
-