Tabnine Logo
org.apache.cassandra.db.marshal
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.cassandra.db.marshal

Best Java code snippets using org.apache.cassandra.db.marshal (Showing top 20 results out of 315)

origin: thinkaurelius/titan

  @Test
  public void timeUUIDComparison() {
    TimeUUIDType ti = TimeUUIDType.instance;

    UUID zu = UUID.fromString(z);
    UUID vu = UUID.fromString(v);

    ByteBuffer zb = ti.decompose(zu);
    ByteBuffer vb = ti.decompose(vu);

    assertEquals(-1, ti.compare(zb, vb));
    assertEquals(1, zu.compareTo(vu));
    assertEquals(1, ti.compare(vb, zb));
    assertEquals(-1, vu.compareTo(zu));
  }
}
origin: Impetus/Kundera

/**
 * Compose.
 * 
 * @param value
 *            the value
 * @param clazz
 *            the clazz
 * @return the byte[]
 */
private static byte[] compose(Object value, Class clazz)
{
  return BooleanType.instance.decompose((Boolean) value).array();
}
origin: Impetus/Kundera

/**
 * Compose.
 * 
 * @param value
 *            the value
 * @param clazz
 *            the clazz
 * @return the byte[]
 */
private static byte[] compose(Object value, Class clazz)
{
  return UUIDType.instance.decompose((UUID) value).array();
}
origin: Impetus/Kundera

return UTF8Type.instance.decompose((String) value);
return Int32Type.instance.decompose(Integer.parseInt(value.toString()));
return LongType.instance.decompose(Long.parseLong(value.toString()));
return BooleanType.instance.decompose(Boolean.valueOf(value.toString()));
return DoubleType.instance.decompose(Double.valueOf(value.toString()));
return UUIDType.instance.decompose(UUID.fromString(value.toString()));
return FloatType.instance.decompose(Float.valueOf(value.toString()));
return DateType.instance.decompose((Date) value);
return BytesType.instance.decompose(ByteBuffer.wrap(PropertyAccessorFactory.getPropertyAccessor(clazz)
    .toBytes(value)));
origin: hector-client/hector

private static CFMetaData compositeCFMD(String ksName, String cfName, AbstractType<?>... types) {
  return new CFMetaData(ksName, cfName, ColumnFamilyType.Standard, CompositeType.getInstance(Arrays.asList(types)), null).rebuild();
}
origin: hector-client/hector

private static CFMetaData dynamicCompositeCFMD(String ksName, String cfName) {
  return new CFMetaData(ksName, cfName, ColumnFamilyType.Standard, DynamicCompositeType.getInstance(alias), null).rebuild();
}
origin: Impetus/Kundera

/**
 * Compose.
 * 
 * @param value
 *            the value
 * @param clazz
 *            the clazz
 * @return the byte[]
 */
private static byte[] compose(Object value, Class clazz)
{
  return DecimalType.instance.decompose((BigDecimal) value).array();
}
origin: Impetus/Kundera

/**
 * Compose.
 * 
 * @param value
 *            the value
 * @param clazz
 *            the clazz
 * @return the byte[]
 */
private static byte[] compose(Object value, Class clazz)
{
  return IntegerType.instance.decompose((BigInteger) value).array();
}
origin: Impetus/Kundera

  /**
   * Decompose.
   * 
   * @param value
   *            the value
   * @param clazz
   *            the clazz
   * @return the object
   */
  private static Object decompose(Object value, Class clazz)
  {
    ByteBuffer buf = ByteBuffer.wrap((byte[]) value, 0, ((byte[]) value).length);
    return DecimalType.instance.compose(buf);
  }
}
origin: Impetus/Kundera

  /**
   * Decompose.
   * 
   * @param value
   *            the value
   * @param clazz
   *            the clazz
   * @return the object
   */
  private static Object decompose(Object value, Class clazz)
  {
    ByteBuffer buf = ByteBuffer.wrap((byte[]) value, 0, ((byte[]) value).length);
    return BooleanType.instance.compose(buf);
  }
}
origin: Impetus/Kundera

  /**
   * Decompose.
   * 
   * @param value
   *            the value
   * @param clazz
   *            the clazz
   * @return the object
   */
  private static Object decompose(Object value, Class clazz)
  {
    ByteBuffer buf = ByteBuffer.wrap((byte[]) value, 0, ((byte[]) value).length);
    return UUIDType.instance.compose(buf);
  }
}
origin: Impetus/Kundera

  /**
   * Decompose.
   * 
   * @param value
   *            the value
   * @param clazz
   *            the clazz
   * @return the object
   */
  private static Object decompose(Object value, Class clazz)
  {
    ByteBuffer buf = ByteBuffer.wrap((byte[]) value, 0, ((byte[]) value).length);
    return AsciiType.instance.compose(buf);
  }
}
origin: Impetus/Kundera

/**
 * Compose.
 * 
 * @param value
 *            the value
 * @param clazz
 *            the clazz
 * @return the byte[]
 */
private static byte[] compose(Object value, Class clazz)
{
  return AsciiType.instance.decompose((String) value).array();
}
origin: Impetus/Kundera

/**
 * Compose.
 * 
 * @param value
 *            the value
 * @param clazz
 *            the clazz
 * @return the byte[]
 */
private static byte[] compose(Object value, Class clazz)
{
  return DateType.instance.decompose((Date) value).array();
}
origin: Impetus/Kundera

/**
 * Compose.
 * 
 * @param value
 *            the value
 * @param clazz
 *            the clazz
 * @return the byte[]
 */
private static byte[] compose(Object value, Class clazz)
{
  return CounterColumnType.instance.decompose((Long) value).array();
}
origin: Impetus/Kundera

  /**
   * Decompose.
   * 
   * @param value
   *            the value
   * @param clazz
   *            the clazz
   * @return the object
   */
  private static Object decompose(Object value, Class clazz)
  {
    ByteBuffer buf = ByteBuffer.wrap((byte[]) value, 0, ((byte[]) value).length);
    return DateType.instance.compose(buf);
  }
}
origin: Impetus/Kundera

  /**
   * Decompose.
   * 
   * @param value
   *            the value
   * @param clazz
   *            the clazz
   * @return the object
   */
  private static Object decompose(Object value, Class clazz)
  {
    ByteBuffer buf = ByteBuffer.wrap((byte[]) value, 0, ((byte[]) value).length);
    return CounterColumnType.instance.compose(buf);
  }
}
origin: Impetus/Kundera

  /**
   * Decompose.
   * 
   * @param value
   *            the value
   * @param clazz
   *            the clazz
   * @return the object
   */
  private static Object decompose(Object value, Class clazz)
  {
    ByteBuffer buf = ByteBuffer.wrap((byte[]) value, 0, ((byte[]) value).length);
    return IntegerType.instance.compose(buf);
  }
}
origin: hector-client/hector

 @Test
 public void test() throws Exception {
  Assert.assertEquals(str, s.fromByteBuffer(s.toByteBuffer(str)));
  if (str != null) {
   Assert
     .assertEquals(str, ByteBufferUtil.string(ByteBufferUtil.bytes(str)));
  }
  if (str != null) {
   UTF8Type.instance.validate(s.toByteBuffer(str));
  }
 }
}
origin: hector-client/hector

@SuppressWarnings("rawtypes")
public DynamicCompositeType getDefaultDynamicComparator() {
 //Well if ? makes you happy then :) Generics FTWhatever
 Map<Byte, AbstractType<?>> aliases = new HashMap<Byte, AbstractType<?>>();
 aliases.put((byte) 'a', AsciiType.instance);
 aliases.put((byte) 'b', BytesType.instance);
 aliases.put((byte) 'i', IntegerType.instance);
 aliases.put((byte) 'x', LexicalUUIDType.instance);
 aliases.put((byte) 'l', LongType.instance);
 aliases.put((byte) 't', TimeUUIDType.instance);
 aliases.put((byte) 's', UTF8Type.instance);
 aliases.put((byte) 'u', UUIDType.instance);
 DynamicCompositeType comparator = DynamicCompositeType.getInstance(aliases);
 return comparator;
}
org.apache.cassandra.db.marshal

Most used classes

  • AbstractType
    Specifies a Comparator for a specific type of ByteBuffer. Note that empty ByteBuffer are used to rep
  • CompositeType
  • ListType
  • MapType
  • SetType
  • BooleanType,
  • TypeParser,
  • UUIDType,
  • BytesType,
  • Int32Type,
  • TimeUUIDType,
  • AsciiType,
  • CollectionType,
  • DecimalType,
  • DoubleType,
  • DynamicCompositeType,
  • FloatType,
  • IntegerType,
  • LongType
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now