Class CustomizableVersion
java.lang.Object
net.okapia.osid.primordium.installation.CustomizableVersion
- All Implemented Interfaces:
Serializable, Comparable<Version>, OsidPrimitive, Version, Version, OsidPrimitive
A
Version that wraps another version and forwards every
method to it, so it carries exactly the wrapped value and the same
identity: it is equal to the version it wraps and to any other
version of the same value. The single seam is toString();
every other method is final, so a subclass cannot reach
anything the contract depends on. Customize the string form by
passing a CustomizableVersion.Codec to version(org.osid.installation.Version, Codec), or by subclassing and overriding toString().
See CustomizableDistance
for the full design rationale (value-based identity, the
toString() seam, and the bundling pattern). Intentionally not
final.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFormats a version to a string and parses it back. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCustomizableVersion(Version delegate) Constructs a newCustomizableVersionthat renders with the wrapped version's own string form.protectedCustomizableVersion(Version delegate, CustomizableVersion.Codec codec) Constructs a newCustomizableVersionthat renders with the given codec. -
Method Summary
Modifier and TypeMethodDescriptionfinal intfinal booleanfinal String[]protected VersionGets the wrapped version.final Typefinal inthashCode()final booleanisExclusive(Version arg0) final booleanisInclusive(Version arg0) final booleanfinal booleantoString()Returns the string form of this version.static CustomizableVersionWraps a version, rendering with its own string form.static CustomizableVersionversion(Version version, CustomizableVersion.Codec codec) Wraps a version, rendering with the given codec.
-
Constructor Details
-
CustomizableVersion
Constructs a newCustomizableVersionthat renders with the wrapped version's own string form.- Parameters:
delegate- the version to wrap- Throws:
NullArgumentException-delegateisnull
-
CustomizableVersion
Constructs a newCustomizableVersionthat renders with the given codec.- Parameters:
delegate- the version to wrapcodec- the codec used bytoString(), ornullto render with the wrapped version's own string form- Throws:
NullArgumentException-delegateisnull
-
-
Method Details
-
version
Wraps a version, rendering with its own string form.- Parameters:
version- the version to wrap- Returns:
- the wrapped version
- Throws:
NullArgumentException-versionisnull
-
version
Wraps a version, rendering with the given codec.- Parameters:
version- the version to wrapcodec- the codec used bytoString()- Returns:
- the wrapped version
- Throws:
NullArgumentException-versionorcodecisnull
-
getDelegate
-
getScheme
-
getComponents
- Specified by:
getComponentsin interfaceVersion
-
isNewer
-
isOlder
-
isInclusive
- Specified by:
isInclusivein interfaceVersion
-
isExclusive
- Specified by:
isExclusivein interfaceVersion
-
compareTo
- Specified by:
compareToin interfaceComparable<Version>- Specified by:
compareToin interfaceVersion
-
equals
-
hashCode
-
toString
Returns the string form of this version. With a codec, this iscodec.format(wrapped); otherwise it is the wrapped version's own string form. This is the one method a subclass may override.- Specified by:
toStringin interfaceOsidPrimitive- Overrides:
toStringin classObject- Returns:
- the string form
-