Class AbstractCompositeType

  • All Implemented Interfaces:
    java.util.Comparator<java.nio.ByteBuffer>, AssignmentTestable
    Direct Known Subclasses:
    CompositeType, DynamicCompositeType

    public abstract class AbstractCompositeType
    extends AbstractType<java.nio.ByteBuffer>
    A class avoiding class duplication between CompositeType and DynamicCompositeType. Those two differs only in that for DynamicCompositeType, the comparators are in the encoded column name at the front of each component.
    • Constructor Detail

      • AbstractCompositeType

        protected AbstractCompositeType()
    • Method Detail

      • compareCustom

        public <VL,​VR> int compareCustom​(VL left,
                                               ValueAccessor<VL> accessorL,
                                               VR right,
                                               ValueAccessor<VR> accessorR)
        Description copied from class: AbstractType
        Implement IFF ComparisonType is CUSTOM Compares the byte representation of two instances of this class, for types where this cannot be done by simple in-order comparison of the unsigned bytes Standard Java compare semantics
        Overrides:
        compareCustom in class AbstractType<java.nio.ByteBuffer>
      • readIsStatic

        protected abstract <V> boolean readIsStatic​(V value,
                                                    ValueAccessor<V> accessor)
      • startingOffset

        protected abstract int startingOffset​(boolean isStatic)
      • split

        public java.nio.ByteBuffer[] split​(java.nio.ByteBuffer bb)
        Split a composite column names into it's components.
      • escape

        public static java.lang.String escape​(java.lang.String input)
      • getString

        public <V> java.lang.String getString​(V input,
                                              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 class AbstractType<java.nio.ByteBuffer>
      • 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 class AbstractType<java.nio.ByteBuffer>
      • 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 class AbstractType<java.nio.ByteBuffer>
        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 class AbstractType<java.nio.ByteBuffer>
        Parameters:
        buffer - the value to convert
        protocolVersion - the protocol version to use for the conversion
        Returns:
        a JSON string representing the specified value
      • decompose

        public abstract java.nio.ByteBuffer decompose​(java.lang.Object... objects)
      • getComparatorSize

        protected abstract <V> int getComparatorSize​(int i,
                                                     V value,
                                                     ValueAccessor<V> accessor,
                                                     int offset)
      • getComparator

        protected abstract <V> AbstractType<?> getComparator​(int i,
                                                             V value,
                                                             ValueAccessor<V> accessor,
                                                             int offset)
        Parameters:
        i - DynamicCompositeType will read the type information from @param bb
        value - name of type definition
        Returns:
        the comparator for the given component. static CompositeType will consult
      • getComparator

        protected abstract <VL,​VR> AbstractType<?> getComparator​(int i,
                                                                       VL left,
                                                                       ValueAccessor<VL> accessorL,
                                                                       VR right,
                                                                       ValueAccessor<VR> accessorR,
                                                                       int offsetL,
                                                                       int offsetR)
        Adds DynamicCompositeType type information from @param bb1 to @param bb2.
        Parameters:
        i - is ignored.
      • getAndAppendComparator

        protected abstract <V> AbstractType<?> getAndAppendComparator​(int i,
                                                                      V value,
                                                                      ValueAccessor<V> accessor,
                                                                      java.lang.StringBuilder sb,
                                                                      int offset)
        Adds type information from @param bb to @param sb. @param i is ignored.