Package me.prettyprint.hector.api

Examples of me.prettyprint.hector.api.Serializer


   * @return ByteBuffer object
   */
  @SuppressWarnings("unchecked")
  public ByteBuffer toByteBuffer(Object value) {
    ByteBuffer byteBuffer = null;
    Serializer serializer = GoraSerializerTypeInferer.getSerializer(value);
    if (serializer == null) {
      LOG.info("Serializer not found for: " + value.toString());
    }
    else {
      byteBuffer = serializer.toByteBuffer(value);
    }

    if (byteBuffer == null) {
      LOG.info("value class=" + value.getClass().getName() + " value=" + value + " -> null");
    }
View Full Code Here


        assertEquals(serializer.getClass(), ObjectSerializer.class);
    }

    @Test
    public void unsupportedClassShouldReturnObjectSerializer() {
        Serializer serializer = ExtensibleTypeInferringSerializer.getSerializer(ArrayList.class);
        assertEquals(serializer.getClass(), ObjectSerializer.class);
    }
View Full Code Here

        assertEquals(serializer.getClass(), ObjectSerializer.class);
    }

    @Test
    public void nullObjectShouldReturnByteBufferSerializer() {
        Serializer serializer = ExtensibleTypeInferringSerializer.getSerializer((Object) null);
        assertEquals(serializer.getClass(), ByteBufferSerializer.class);
    }
View Full Code Here

    }

    @SuppressWarnings({"NullableProblems"})
    @Test
    public void nullClassShouldReturnByteBufferSerializer() {
        Serializer serializer = ExtensibleTypeInferringSerializer.getSerializer(null);
        assertEquals(serializer.getClass(), ByteBufferSerializer.class);
    }
View Full Code Here

public class TestBigDecimalSerializer {
    @Test
    public void BigDecimalObjectShouldReturnBigDecimalSerializer() {
        ExtensibleTypeInferringSerializer.addSerializer(BigDecimal.class, BigDecimalSerializer.get());
        BigDecimal value = new BigDecimal(1);
        Serializer serializer = ExtensibleTypeInferringSerializer.getSerializer(value);
        assertEquals(serializer.getClass(), BigDecimalSerializer.class);
    }
View Full Code Here

    }

    @Test
    public void BigDecimalClassShouldReturnBigDecimalSerializer() {
        ExtensibleTypeInferringSerializer.addSerializer(BigDecimal.class, BigDecimalSerializer.get());
        Serializer serializer = ExtensibleTypeInferringSerializer.getSerializer(BigDecimal.class);
        assertEquals(serializer.getClass(), BigDecimalSerializer.class);
    }
View Full Code Here

    @Test
    public void SerializingThenDeserializingBigDecimalResultsInSameBigDecimal() {
        ExtensibleTypeInferringSerializer.addSerializer(BigDecimal.class, BigDecimalSerializer.get());
        BigDecimal value = new BigDecimal(1);

        Serializer serializer = ExtensibleTypeInferringSerializer.getSerializer(BigDecimal.class);

        ByteBuffer buffer = serializer.toByteBuffer(value);

        BigDecimal deserializedBigDecimal = (BigDecimal) serializer.fromByteBuffer(buffer);

        assertEquals(value, deserializedBigDecimal);
    }
View Full Code Here

public class TestDateTimeSerializer {
    @Test
    public void DateTimeObjectShouldReturnDateTimeSerializer() {
        ExtensibleTypeInferringSerializer.addSerializer(DateTime.class, DateTimeSerializer.get());
        DateTime value = new DateTime();
        Serializer serializer = ExtensibleTypeInferringSerializer.getSerializer(value);
        assertEquals(serializer.getClass(), DateTimeSerializer.class);
    }
View Full Code Here

    }

    @Test
    public void DateTimeClassShouldReturnDateTimeSerializer() {
        ExtensibleTypeInferringSerializer.addSerializer(DateTime.class, DateTimeSerializer.get());
        Serializer serializer = ExtensibleTypeInferringSerializer.getSerializer(DateTime.class);
        assertEquals(serializer.getClass(), DateTimeSerializer.class);
    }
View Full Code Here

    @Test
    public void SerializingThenDeserializingDateTimeResultsInSameDateTime() {
        ExtensibleTypeInferringSerializer.addSerializer(DateTime.class, DateTimeSerializer.get());
        DateTime value = new DateTime(2000, 1, 1, 12, 0);

        Serializer serializer = ExtensibleTypeInferringSerializer.getSerializer(DateTime.class);

        ByteBuffer buffer = serializer.toByteBuffer(value);

        DateTime deserializedDateTime = (DateTime) serializer.fromByteBuffer(buffer);

        assertEquals(value, deserializedDateTime);
    }
View Full Code Here

TOP

Related Classes of me.prettyprint.hector.api.Serializer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.