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 CounterColumnType
instance
-
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.ByteBuffer
add(NumberType<?> leftType, java.nio.ByteBuffer left, NumberType<?> rightType, java.nio.ByteBuffer right)
Adds the left argument to the right one.CQL3Type
asCQL3Type()
<V> java.lang.Long
compose(V value, ValueAccessor<V> accessor)
java.nio.ByteBuffer
decompose(java.lang.Long value)
java.nio.ByteBuffer
divide(NumberType<?> leftType, java.nio.ByteBuffer left, NumberType<?> rightType, java.nio.ByteBuffer right)
Divides the left argument by the right one.Term
fromJSONObject(java.lang.Object parsed)
Given a parsed JSON string, return a byte representation of the object.java.nio.ByteBuffer
fromString(java.lang.String source)
get a byte representation of the given string.TypeSerializer<java.lang.Long>
getSerializer()
<V> java.lang.String
getString(V value, ValueAccessor<V> accessor)
get a string representation of the bytes used for various identifier (NOT just for log messages)boolean
isCounter()
boolean
isEmptyValueMeaningless()
java.nio.ByteBuffer
mod(NumberType<?> leftType, java.nio.ByteBuffer left, NumberType<?> rightType, java.nio.ByteBuffer right)
Return the remainder.java.nio.ByteBuffer
multiply(NumberType<?> leftType, java.nio.ByteBuffer left, NumberType<?> rightType, java.nio.ByteBuffer right)
Multiplies the left argument with the right one.java.nio.ByteBuffer
negate(java.nio.ByteBuffer input)
Negates the argument.java.nio.ByteBuffer
substract(NumberType<?> leftType, java.nio.ByteBuffer left, NumberType<?> rightType, java.nio.ByteBuffer right)
Substracts the left argument from the right one.java.lang.String
toJSONString(java.nio.ByteBuffer buffer, ProtocolVersion protocolVersion)
Converts the specified value into its JSON representation.protected long
toLong(java.nio.ByteBuffer value)
Converts the specified value into along
if allowed.<V> void
validateCellValue(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, expandUserTypes, freeze, freezeNestedMulticellTypes, getComponents, getString, getString, isCollection, isCompatibleWith, isFreezable, isFrozenCollection, isMultiCell, isReversed, isTuple, isUDT, isValueCompatibleWith, isValueCompatibleWithInternal, parseDefaultParameters, read, readArray, readBuffer, readBuffer, referencesDuration, referencesUserType, referencesUserType, skipValue, subTypes, testAssignment, testAssignment, toJSONString, toString, toString, 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:
isEmptyValueMeaningless
in classAbstractType<java.lang.Long>
-
isCounter
public boolean isCounter()
- Overrides:
isCounter
in classAbstractType<java.lang.Long>
-
compose
public <V> java.lang.Long compose(V value, ValueAccessor<V> accessor)
- Overrides:
compose
in classAbstractType<java.lang.Long>
-
decompose
public java.nio.ByteBuffer decompose(java.lang.Long value)
- Overrides:
decompose
in classAbstractType<java.lang.Long>
-
validateCellValue
public <V> void validateCellValue(V cellValue, ValueAccessor<V> accessor) throws MarshalException
Description copied from class:AbstractType
Validate 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:
validateCellValue
in 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:AbstractType
get a string representation of the bytes used for various identifier (NOT just for log messages)- Overrides:
getString
in classAbstractType<java.lang.Long>
-
fromString
public java.nio.ByteBuffer fromString(java.lang.String source)
Description copied from class:AbstractType
get a byte representation of the given string.- Specified by:
fromString
in classAbstractType<java.lang.Long>
-
fromJSONObject
public Term fromJSONObject(java.lang.Object parsed)
Description copied from class:AbstractType
Given a parsed JSON string, return a byte representation of the object.- Specified by:
fromJSONObject
in 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:AbstractType
Converts the specified value into its JSON representation.The buffer position will stay the same.
- Overrides:
toJSONString
in 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:
asCQL3Type
in classAbstractType<java.lang.Long>
-
getSerializer
public TypeSerializer<java.lang.Long> getSerializer()
- Specified by:
getSerializer
in classAbstractType<java.lang.Long>
-
toLong
protected long toLong(java.nio.ByteBuffer value)
Description copied from class:NumberType
Converts the specified value into along
if allowed.- Overrides:
toLong
in 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:NumberType
Adds the left argument to the right one.- Specified by:
add
in 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:NumberType
Substracts the left argument from the right one.- Specified by:
substract
in 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:NumberType
Multiplies the left argument with the right one.- Specified by:
multiply
in 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:NumberType
Divides the left argument by the right one.- Specified by:
divide
in 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:NumberType
Return the remainder.- Specified by:
mod
in 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:NumberType
Negates the argument.- Specified by:
negate
in classNumberType<java.lang.Long>
- Parameters:
input
- the argument to negate- Returns:
- the negated argument
-
-