protected ByteBuffer objToBB ( Object o ) { if ( o == null ) return nullToBB ( ) ; if ( o instanceof java . lang . String ) return ByteBuffer . wrap ( new DataByteArray ( ( String ) o ) . get ( ) ) ; if ( o instanceof Integer ) return Int32Type . instance . decompose ( ( Integer ) o ) ; if ( o instanceof Long ) return LongType . instance . decompose ( ( Long ) o ) ; if ( o instanceof Float ) return FloatType . instance . decompose ( ( Float ) o ) ; if ( o instanceof Double ) return DoubleType . instance . decompose ( ( Double ) o ) ; if ( o instanceof UUID ) return ByteBuffer . wrap ( UUIDGen . decompose ( ( UUID ) o ) ) ; if ( o instanceof Tuple ) { List < Object > objects = ( ( Tuple ) o ) . getAll ( ) ; //collections if ( objects . size ( ) > 0 && objects . get ( 0 ) instanceof String ) { String collectionType = ( String ) objects . get ( 0 ) ; if ( "set" . equalsIgnoreCase ( collectionType ) || "list" . equalsIgnoreCase ( collectionType ) ) return objToListOrSetBB ( objects . subList ( 1 , objects . size ( ) ) ) ; else if ( "map" . equalsIgnoreCase ( collectionType ) ) return objToMapBB ( objects . subList ( 1 , objects . size ( ) ) ) ; } return objToCompositeBB ( objects ) ; } return ByteBuffer . wrap ( ( ( DataByteArray ) o ) . get ( ) ) ; }
convert object to ByteBuffer