src/java/org/apache/cassandra/db/marshal/AbstractCompositeType.java
/*
     * FIXME: this would break if some of the component string representation
     * contains ':'. None of our current comparator do so, so this is probably
     * not an urgent matter, but this could break for custom comparator.
     * (DynamicCompositeType would break on '@' too)
     */
this would break if some of the component string representation
contains ':'. None of our current comparator do so, so this is probably
not an urgent matter, but this could break for custom comparator.
(DynamicCompositeType would break on '@' too)
this would break if some of the component string representation contains ' : ' . None of our current comparator do so so this is probably not an urgent matter but this could break for custom comparator . ( DynamicCompositeType would break on ' @ ' too )
public ByteBuffer fromString(String source)
    {
        String[] parts = source.split(":");
        List<ByteBuffer> components = new ArrayList<ByteBuffer>();
        List<ParsedComparator> comparators = new ArrayList<ParsedComparator>();
        int totalLength = 0, i = 0;
        boolean lastByteIsOne = false;
        for (String part : parts)
        {
            if (part.equals("!"))
            {
                lastByteIsOne = true;
                break;
            }
            ParsedComparator p = parseNextComparator(i, part);
            AbstractType type = p.getAbstractType();
            part = p.getRemainingPart();
            ByteBuffer component = type.fromString(part);
            totalLength += p.getComparatorSerializedSize() + 2 + component.remaining() + 1;
            components.add(component);
            comparators.add(p);
            ++i;
        }
        ByteBuffer bb = ByteBuffer.allocate(totalLength);
        i = 0;
        for (ByteBuffer component : components)
        {
            comparators.get(i).serializeComparator(bb);
            putShortLength(bb, component.remaining());
            bb.put(component); 
            bb.put((byte)0);
            ++i;
        }
        if (lastByteIsOne)
            bb.put(bb.limit() - 1, (byte)1);
        bb.rewind();
        return bb;
    }
public ByteBuffer fromString ( String source ) { String [ ] parts = source . split ( ":" ) ; List < ByteBuffer > components = new ArrayList < ByteBuffer > ( ) ; List < ParsedComparator > comparators = new ArrayList < ParsedComparator > ( ) ; int totalLength = 0 , i = 0 ; boolean lastByteIsOne = false ; for ( String part : parts ) { if ( part . equals ( "!" ) ) { lastByteIsOne = true ; break ; } ParsedComparator p = parseNextComparator ( i , part ) ; AbstractType type = p . getAbstractType ( ) ; part = p . getRemainingPart ( ) ; ByteBuffer component = type . fromString ( part ) ; totalLength += p . getComparatorSerializedSize ( ) + 2 + component . remaining ( ) + 1 ; components . add ( component ) ; comparators . add ( p ) ; ++ i ; } ByteBuffer bb = ByteBuffer . allocate ( totalLength ) ; i = 0 ; for ( ByteBuffer component : components ) { comparators . get ( i ) . serializeComparator ( bb ) ; putShortLength ( bb , component . remaining ( ) ) ; bb . put ( component ) ; bb . put ( ( byte ) 0 ) ; ++ i ; } if ( lastByteIsOne ) bb . put ( bb . limit ( ) - 1 , ( byte ) 1 ) ; bb . rewind ( ) ; return bb ; }
FIXME: this would break if some of the component string representation
 contains ':'.
FIXME : this would break if some of the component string representation contains ' : ' .
// it's ok to consume component as we won't use it anymore