Class CustomizableTime
java.lang.Object
net.okapia.osid.primordium.calendaring.time.CustomizableTime
- All Implemented Interfaces:
Serializable, Comparable<Time>, OsidPrimitive, Time, Time, OsidPrimitive
A
Time that wraps another time and forwards every
method to it, so it carries exactly the wrapped value and the same
identity: it is equal to the time it wraps and to any other
time 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 CustomizableTime.Codec to time(org.osid.calendaring.Time, 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 time to a string and parses it back. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCustomizableTime(Time delegate) Constructs a newCustomizableTimethat renders with the wrapped time's own string form.protectedCustomizableTime(Time delegate, CustomizableTime.Codec codec) Constructs a newCustomizableTimethat renders with the given codec. -
Method Summary
Modifier and TypeMethodDescriptionfinal intfinal Time[]final booleanfinal longprotected TimeGets the wrapped time.final longfinal DateTimeResolutionfinal longfinal longgetHour()final longfinal longfinal longfinal longfinal longfinal longfinal longfinal longfinal longfinal longfinal longfinal Typefinal longfinal longfinal inthashCode()final booleanisExclusive(Time arg0) final booleanfinal booleanisInclusive(Time arg0) final booleanstatic CustomizableTimeWraps a time, rendering with its own string form.static CustomizableTimetime(Time time, CustomizableTime.Codec codec) Wraps a time, rendering with the given codec.toString()Returns the string form of this time.
-
Constructor Details
-
CustomizableTime
Constructs a newCustomizableTimethat renders with the wrapped time's own string form.- Parameters:
delegate- the time to wrap- Throws:
NullArgumentException-delegateisnull
-
CustomizableTime
Constructs a newCustomizableTimethat renders with the given codec.- Parameters:
delegate- the time to wrapcodec- the codec used bytoString(), ornullto render with the wrapped time's own string form- Throws:
NullArgumentException-delegateisnull
-
-
Method Details
-
time
Wraps a time, rendering with its own string form.- Parameters:
time- the time to wrap- Returns:
- the wrapped time
- Throws:
NullArgumentException-timeisnull
-
time
Wraps a time, rendering with the given codec.- Parameters:
time- the time to wrapcodec- the codec used bytoString()- Returns:
- the wrapped time
- Throws:
NullArgumentException-timeorcodecisnull
-
getDelegate
-
getTimeType
- Specified by:
getTimeTypein interfaceTime
-
getHour
-
getMinute
-
getSecond
-
getMilliseconds
- Specified by:
getMillisecondsin interfaceTime
-
getMicroseconds
- Specified by:
getMicrosecondsin interfaceTime
-
getNanoseconds
- Specified by:
getNanosecondsin interfaceTime
-
getPicoseconds
- Specified by:
getPicosecondsin interfaceTime
-
getFemtoseconds
- Specified by:
getFemtosecondsin interfaceTime
-
getAttoseconds
- Specified by:
getAttosecondsin interfaceTime
-
getZeptoseconds
- Specified by:
getZeptosecondsin interfaceTime
-
getYoctoseconds
- Specified by:
getYoctosecondsin interfaceTime
-
getRontoseconds
- Specified by:
getRontosecondsin interfaceTime
-
getQuectoseconds
- Specified by:
getQuectosecondsin interfaceTime
-
getMilliquectoseconds
- Specified by:
getMilliquectosecondsin interfaceTime
-
getMicroquectoseconds
- Specified by:
getMicroquectosecondsin interfaceTime
-
getPlanckseconds
- Specified by:
getPlancksecondsin interfaceTime
-
getGranularity
- Specified by:
getGranularityin interfaceTime
-
getGranularityMultiplier
- Specified by:
getGranularityMultiplierin interfaceTime
-
isGreater
-
isLess
-
isInclusive
- Specified by:
isInclusivein interfaceTime
-
isExclusive
- Specified by:
isExclusivein interfaceTime
-
denormalizeTime
- Specified by:
denormalizeTimein interfaceTime
-
compareTo
- Specified by:
compareToin interfaceComparable<Time>- Specified by:
compareToin interfaceTime
-
equals
-
hashCode
-
toString
Returns the string form of this time. With a codec, this iscodec.format(wrapped); otherwise it is the wrapped time's own string form. This is the one method a subclass may override.- Specified by:
toStringin interfaceOsidPrimitive- Overrides:
toStringin classObject- Returns:
- the string form
-