Package org.apache.cassandra.db.marshal
Class TemporalType<T>
java.lang.Object
org.apache.cassandra.db.marshal.AbstractType<T>
org.apache.cassandra.db.marshal.TemporalType<T>
- All Implemented Interfaces:
Comparator<ByteBuffer>,AssignmentTestable
- Direct Known Subclasses:
AbstractTimeUUIDType,SimpleDateType,TimestampType,TimeType
Base type for temporal types (timestamp, date ...).
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.cassandra.db.marshal.AbstractType
AbstractType.ComparisonType, AbstractType.DefaultArgumentDeserializerNested classes/interfaces inherited from interface org.apache.cassandra.cql3.AssignmentTestable
AssignmentTestable.TestResult -
Field Summary
Fields inherited from class org.apache.cassandra.db.marshal.AbstractType
comparatorSet, comparisonType, isByteOrderComparable, reverseComparator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddDuration(Number temporal, Duration duration) Adds the duration to the specified value.fromTimeInMillis(long timeInMillis) Returns the temporal value corresponding to the specified UNIX timestamp.now()Returns the current temporal value.substractDuration(Number temporal, Duration duration) Substract the duration from the specified value.longtoTimeInMillis(ByteBuffer value) Converts this temporal in UNIX timestamp.protected voidvalidateDuration(Duration duration) Validates that the duration has the correct precision.Methods inherited from class org.apache.cassandra.db.marshal.AbstractType
allowsEmpty, asComparableBytes, asComparableBytes, asCQL3Type, asCQLTypeStringList, checkComparable, compare, compare, compareCollectionMembers, compareCustom, compareForCQL, compose, compose, decompose, decomposeUntyped, expandUserTypes, freeze, freezeNestedMulticellTypes, fromComparableBytes, fromComparableBytes, fromJSONObject, fromString, getCompatibleTypeIfKnown, getComponents, getMaskedValue, getSerializer, getString, getString, getString, isCollection, isCompatibleWith, isCounter, isEmptyValueMeaningless, isFreezable, isFrozenCollection, isMultiCell, isNull, isNull, isReversed, isSerializationCompatibleWith, isTuple, isUDT, isValueCompatibleWith, isValueCompatibleWithInternal, isValueLengthFixed, isVector, parseDefaultParameters, read, readArray, readBuffer, readBuffer, referencesDuration, referencesUserType, referencesUserType, skipValue, subTypes, testAssignment, testAssignment, toCQLString, toJSONString, toJSONString, toString, toString, udfType, unfreeze, unwrap, validate, validate, validateCellValue, validateCollectionMember, valueLengthIfFixed, withUpdatedUserType, writeValue, writeValue, writtenLength, writtenLengthMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
TemporalType
-
-
Method Details
-
now
Returns the current temporal value.- Returns:
- the current temporal value.
-
toTimeInMillis
Converts this temporal in UNIX timestamp.- Parameters:
value- the temporal value.- Returns:
- the UNIX timestamp corresponding to this temporal.
-
fromTimeInMillis
Returns the temporal value corresponding to the specified UNIX timestamp.- Parameters:
timeInMillis- the UNIX timestamp to convert- Returns:
- the temporal value corresponding to the specified UNIX timestamp
-
addDuration
Adds the duration to the specified value.- Parameters:
temporal- the value to add toduration- the duration to add- Returns:
- the addition result
-
substractDuration
Substract the duration from the specified value.- Parameters:
temporal- the value to substract fromduration- the duration to substract- Returns:
- the substracion result
-
validateDuration
Validates that the duration has the correct precision.- Parameters:
duration- the duration to validate.
-
getArgumentDeserializer
- Overrides:
getArgumentDeserializerin classAbstractType<T>- Returns:
- the deserializer used to deserialize the function arguments of this type.
-