Package org.apache.cassandra.db.marshal
Class CounterColumnType
- java.lang.Object
-
- org.apache.cassandra.db.marshal.AbstractType<T>
-
- org.apache.cassandra.db.marshal.NumberType<java.lang.Long>
-
- org.apache.cassandra.db.marshal.CounterColumnType
-
- All Implemented Interfaces:
java.util.Comparator<java.nio.ByteBuffer>,AssignmentTestable
public class CounterColumnType extends NumberType<java.lang.Long>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.cassandra.db.marshal.AbstractType
AbstractType.ComparisonType
-
Nested classes/interfaces inherited from interface org.apache.cassandra.cql3.AssignmentTestable
AssignmentTestable.TestResult
-
-
Field Summary
Fields Modifier and Type Field Description static CounterColumnTypeinstance-
Fields inherited from class org.apache.cassandra.db.marshal.AbstractType
comparatorSet, comparisonType, isByteOrderComparable, reverseComparator
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.ByteBufferadd(NumberType<?> leftType, java.nio.ByteBuffer left, NumberType<?> rightType, java.nio.ByteBuffer right)Adds the left argument to the right one.CQL3TypeasCQL3Type()<V> java.lang.Longcompose(V value, ValueAccessor<V> accessor)java.nio.ByteBufferdecompose(java.lang.Long value)java.nio.ByteBufferdivide(NumberType<?> leftType, java.nio.ByteBuffer left, NumberType<?> rightType, java.nio.ByteBuffer right)Divides the left argument by the right one.TermfromJSONObject(java.lang.Object parsed)Given a parsed JSON string, return a byte representation of the object.java.nio.ByteBufferfromString(java.lang.String source)get a byte representation of the given string.TypeSerializer<java.lang.Long>getSerializer()<V> java.lang.StringgetString(V value, ValueAccessor<V> accessor)get a string representation of the bytes used for various identifier (NOT just for log messages)booleanisCounter()booleanisEmptyValueMeaningless()java.nio.ByteBuffermod(NumberType<?> leftType, java.nio.ByteBuffer left, NumberType<?> rightType, java.nio.ByteBuffer right)Return the remainder.java.nio.ByteBuffermultiply(NumberType<?> leftType, java.nio.ByteBuffer left, NumberType<?> rightType, java.nio.ByteBuffer right)Multiplies the left argument with the right one.java.nio.ByteBuffernegate(java.nio.ByteBuffer input)Negates the argument.java.nio.ByteBuffersubstract(NumberType<?> leftType, java.nio.ByteBuffer left, NumberType<?> rightType, java.nio.ByteBuffer right)Substracts the left argument from the right one.java.lang.StringtoJSONString(java.nio.ByteBuffer buffer, ProtocolVersion protocolVersion)Converts the specified value into its JSON representation.protected longtoLong(java.nio.ByteBuffer value)Converts the specified value into alongif allowed.<V> voidvalidateCellValue(V cellValue, ValueAccessor<V> accessor)Validate cell value.-
Methods inherited from class org.apache.cassandra.db.marshal.NumberType
isFloatingPoint, toBigDecimal, toBigInteger, toByte, toDouble, toFloat, toInt, toShort
-
Methods inherited from class org.apache.cassandra.db.marshal.AbstractType
asCQLTypeStringList, checkComparable, compare, compare, compareCollectionMembers, compareCustom, compareForCQL, compose, decomposeUntyped, expandUserTypes, freeze, freezeNestedMulticellTypes, getComponents, getString, getString, isCollection, isCompatibleWith, isFreezable, isFrozenCollection, isMultiCell, isReversed, isSerializationCompatibleWith, isTuple, isUDT, isValueCompatibleWith, isValueCompatibleWithInternal, parseDefaultParameters, read, readArray, readBuffer, readBuffer, referencesDuration, referencesUserType, referencesUserType, skipValue, subTypes, testAssignment, testAssignment, toCQLString, toJSONString, toString, toString, udfType, unwrap, validate, validate, validateCollectionMember, valueLengthIfFixed, withUpdatedUserType, writeValue, writeValue, writtenLength, writtenLength
-
-
-
-
Field Detail
-
instance
public static final CounterColumnType instance
-
-
Method Detail
-
isEmptyValueMeaningless
public boolean isEmptyValueMeaningless()
Description copied from class:AbstractType- Overrides:
isEmptyValueMeaninglessin classAbstractType<java.lang.Long>
-
isCounter
public boolean isCounter()
- Overrides:
isCounterin classAbstractType<java.lang.Long>
-
compose
public <V> java.lang.Long compose(V value, ValueAccessor<V> accessor)- Overrides:
composein classAbstractType<java.lang.Long>
-
decompose
public java.nio.ByteBuffer decompose(java.lang.Long value)
- Overrides:
decomposein classAbstractType<java.lang.Long>
-
validateCellValue
public <V> void validateCellValue(V cellValue, ValueAccessor<V> accessor) throws MarshalExceptionDescription copied from class:AbstractTypeValidate cell value. Unlike AbstractType.validate(java.nio.ByteBuffer), cell value is passed to validate its content. Usually, this is the same as validate except collection.- Overrides:
validateCellValuein classAbstractType<java.lang.Long>- Parameters:
cellValue- ByteBuffer representing cell value- Throws:
MarshalException
-
getString
public <V> java.lang.String getString(V value, ValueAccessor<V> accessor)Description copied from class:AbstractTypeget a string representation of the bytes used for various identifier (NOT just for log messages)- Overrides:
getStringin classAbstractType<java.lang.Long>
-
fromString
public java.nio.ByteBuffer fromString(java.lang.String source)
Description copied from class:AbstractTypeget a byte representation of the given string.- Specified by:
fromStringin classAbstractType<java.lang.Long>
-
fromJSONObject
public Term fromJSONObject(java.lang.Object parsed)
Description copied from class:AbstractTypeGiven a parsed JSON string, return a byte representation of the object.- Specified by:
fromJSONObjectin classAbstractType<java.lang.Long>- Parameters:
parsed- the result of parsing a json string
-
toJSONString
public java.lang.String toJSONString(java.nio.ByteBuffer buffer, ProtocolVersion protocolVersion)Description copied from class:AbstractTypeConverts the specified value into its JSON representation.The buffer position will stay the same.
- Overrides:
toJSONStringin classAbstractType<java.lang.Long>- Parameters:
buffer- the value to convertprotocolVersion- the protocol version to use for the conversion- Returns:
- a JSON string representing the specified value
-
asCQL3Type
public CQL3Type asCQL3Type()
- Overrides:
asCQL3Typein classAbstractType<java.lang.Long>
-
getSerializer
public TypeSerializer<java.lang.Long> getSerializer()
- Specified by:
getSerializerin classAbstractType<java.lang.Long>
-
toLong
protected long toLong(java.nio.ByteBuffer value)
Description copied from class:NumberTypeConverts the specified value into alongif allowed.- Overrides:
toLongin classNumberType<java.lang.Long>- Parameters:
value- the value to convert- Returns:
- the converted value
-
add
public java.nio.ByteBuffer add(NumberType<?> leftType, java.nio.ByteBuffer left, NumberType<?> rightType, java.nio.ByteBuffer right)
Description copied from class:NumberTypeAdds the left argument to the right one.- Specified by:
addin classNumberType<java.lang.Long>- Parameters:
leftType- the type associated to the left argumentleft- the left argumentrightType- the type associated to the right argumentright- the right argument- Returns:
- the addition result
-
substract
public java.nio.ByteBuffer substract(NumberType<?> leftType, java.nio.ByteBuffer left, NumberType<?> rightType, java.nio.ByteBuffer right)
Description copied from class:NumberTypeSubstracts the left argument from the right one.- Specified by:
substractin classNumberType<java.lang.Long>- Parameters:
leftType- the type associated to the left argumentleft- the left argumentrightType- the type associated to the right argumentright- the right argument- Returns:
- the substraction result
-
multiply
public java.nio.ByteBuffer multiply(NumberType<?> leftType, java.nio.ByteBuffer left, NumberType<?> rightType, java.nio.ByteBuffer right)
Description copied from class:NumberTypeMultiplies the left argument with the right one.- Specified by:
multiplyin classNumberType<java.lang.Long>- Parameters:
leftType- the type associated to the left argumentleft- the left argumentrightType- the type associated to the right argumentright- the right argument- Returns:
- the multiplication result
-
divide
public java.nio.ByteBuffer divide(NumberType<?> leftType, java.nio.ByteBuffer left, NumberType<?> rightType, java.nio.ByteBuffer right)
Description copied from class:NumberTypeDivides the left argument by the right one.- Specified by:
dividein classNumberType<java.lang.Long>- Parameters:
leftType- the type associated to the left argumentleft- the left argumentrightType- the type associated to the right argumentright- the right argument- Returns:
- the division result
-
mod
public java.nio.ByteBuffer mod(NumberType<?> leftType, java.nio.ByteBuffer left, NumberType<?> rightType, java.nio.ByteBuffer right)
Description copied from class:NumberTypeReturn the remainder.- Specified by:
modin classNumberType<java.lang.Long>- Parameters:
leftType- the type associated to the left argumentleft- the left argumentrightType- the type associated to the right argumentright- the right argument- Returns:
- the remainder
-
negate
public java.nio.ByteBuffer negate(java.nio.ByteBuffer input)
Description copied from class:NumberTypeNegates the argument.- Specified by:
negatein classNumberType<java.lang.Long>- Parameters:
input- the argument to negate- Returns:
- the negated argument
-
-