Example usage for java.lang Float valueOf

List of usage examples for java.lang Float valueOf

Introduction

In this page you can find the example usage for java.lang Float valueOf.

Prototype

@HotSpotIntrinsicCandidate
public static Float valueOf(float f) 

Source Link

Document

Returns a Float instance representing the specified float value.

Usage

From source file:gov.nih.nci.caintegrator.common.CentralTendencyCalculatorTest.java

/**
 * Calculate central tendency with variance as a value.
 *///from w  w  w .j  a  v  a  2  s  . c  o  m
@Test
public void calculateCentralTendencyValueWithVarianceAsValue() {
    calculatorWithVarianceValue.calculateCentralTendencyValue(values2);
    assertEquals(Float.valueOf("4.5"), calculatorWithVarianceValue.getCentralTendencyValue());
    assertTrue(calculatorWithVarianceValue.isHighVariance());
    values2 = ArrayUtils.add(values2, 4.5f);
    calculatorWithVarianceValue.calculateCentralTendencyValue(values2);
    assertFalse(calculatorWithVarianceValue.isHighVariance());
}

From source file:me.willowcheng.makerthings.model.OpenHABWidget.java

public OpenHABWidget(OpenHABWidget parent, Node startNode) {
    this.parent = parent;
    this.children = new ArrayList<OpenHABWidget>();
    this.mappings = new ArrayList<OpenHABWidgetMapping>();
    if (startNode.hasChildNodes()) {
        NodeList childNodes = startNode.getChildNodes();
        for (int i = 0; i < childNodes.getLength(); i++) {
            Node childNode = childNodes.item(i);
            if (childNode.getNodeName().equals("item")) {
                this.setItem(new OpenHABItem(childNode));
            } else if (childNode.getNodeName().equals("linkedPage")) {
                this.setLinkedPage(new OpenHABLinkedPage(childNode));
            } else if (childNode.getNodeName().equals("widget")) {
                new OpenHABWidget(this, childNode);
            } else {
                if (childNode.getNodeName().equals("type")) {
                    this.setType(childNode.getTextContent());
                } else if (childNode.getNodeName().equals("widgetId")) {
                    this.setId(childNode.getTextContent());
                } else if (childNode.getNodeName().equals("label")) {
                    this.setLabel(childNode.getTextContent());
                } else if (childNode.getNodeName().equals("icon")) {
                    this.setIcon(childNode.getTextContent());
                } else if (childNode.getNodeName().equals("url")) {
                    this.setUrl(childNode.getTextContent());
                } else if (childNode.getNodeName().equals("minValue")) {
                    setMinValue(Float.valueOf(childNode.getTextContent()).floatValue());
                } else if (childNode.getNodeName().equals("maxValue")) {
                    setMaxValue(Float.valueOf(childNode.getTextContent()).floatValue());
                } else if (childNode.getNodeName().equals("step")) {
                    setStep(Float.valueOf(childNode.getTextContent()).floatValue());
                } else if (childNode.getNodeName().equals("refresh")) {
                    setRefresh(Integer.valueOf(childNode.getTextContent()).intValue());
                } else if (childNode.getNodeName().equals("period")) {
                    setPeriod(childNode.getTextContent());
                } else if (childNode.getNodeName().equals("service")) {
                    setService(childNode.getTextContent());
                } else if (childNode.getNodeName().equals("height")) {
                    setHeight(Integer.valueOf(childNode.getTextContent()));
                } else if (childNode.getNodeName().equals("mapping")) {
                    NodeList mappingChildNodes = childNode.getChildNodes();
                    String mappingCommand = "";
                    String mappingLabel = "";
                    for (int k = 0; k < mappingChildNodes.getLength(); k++) {
                        if (mappingChildNodes.item(k).getNodeName().equals("command"))
                            mappingCommand = mappingChildNodes.item(k).getTextContent();
                        if (mappingChildNodes.item(k).getNodeName().equals("label"))
                            mappingLabel = mappingChildNodes.item(k).getTextContent();
                    }//www . j  a va 2s .  c om
                    OpenHABWidgetMapping mapping = new OpenHABWidgetMapping(mappingCommand, mappingLabel);
                    mappings.add(mapping);
                } else if (childNode.getNodeName().equals("iconcolor")) {
                    setIconColor(childNode.getTextContent());
                } else if (childNode.getNodeName().equals("labelcolor")) {
                    setLabelColor(childNode.getTextContent());
                } else if (childNode.getNodeName().equals("valuecolor")) {
                    setValueColor(childNode.getTextContent());
                } else if (childNode.getNodeName().equals("encoding")) {
                    setEncoding(childNode.getTextContent());
                }
            }
        }
    }
    this.parent.addChildWidget(this);
}

From source file:com.ewcms.common.query.mongo.EasyQueryInit.java

private List<LimitLog> findLimitLog(final String id) throws IOException {
    DataOperator<LimitLog> operator = new DataOperator<LimitLog>("limitlog.csv");
    List<LimitLog> logs = operator.loadData(new MapperCallback<LimitLog>() {
        @Override/*from   ww w .  j ava 2  s .c o  m*/
        public LimitLog mapping(String line) {
            String[] array = line.split(",");
            if (!array[1].equals(id)) {
                return null;
            }
            LimitLog log = new LimitLog();
            log.setMoney(Float.valueOf(array[2]).intValue());
            try {
                log.setDate(format.parse(array[3]));
            } catch (ParseException e) {
                e.printStackTrace();
            }
            return log;
        }
    });
    return logs;
}

From source file:com.glaf.core.util.Tools.java

public static Object getValue(Class<?> type, String propertyValue) {
    if (type == null || propertyValue == null || propertyValue.trim().length() == 0) {
        return null;
    }/*from  w w  w.  j a va 2 s .  c om*/
    Object value = null;
    try {
        if (type == String.class) {
            value = propertyValue;
        } else if ((type == Integer.class) || (type == int.class)) {
            if (propertyValue.indexOf(',') != -1) {
                propertyValue = propertyValue.replaceAll(",", "");
            }
            value = Integer.parseInt(propertyValue);
        } else if ((type == Long.class) || (type == long.class)) {
            if (propertyValue.indexOf(',') != -1) {
                propertyValue = propertyValue.replaceAll(",", "");
            }
            value = Long.parseLong(propertyValue);
        } else if ((type == Float.class) || (type == float.class)) {
            if (propertyValue.indexOf(',') != -1) {
                propertyValue = propertyValue.replaceAll(",", "");
            }
            value = Float.valueOf(propertyValue);
        } else if ((type == Double.class) || (type == double.class)) {
            if (propertyValue.indexOf(',') != -1) {
                propertyValue = propertyValue.replaceAll(",", "");
            }
            value = Double.parseDouble(propertyValue);
        } else if ((type == Boolean.class) || (type == boolean.class)) {
            value = Boolean.valueOf(propertyValue);
        } else if ((type == Character.class) || (type == char.class)) {
            value = Character.valueOf(propertyValue.charAt(0));
        } else if ((type == Short.class) || (type == short.class)) {
            if (propertyValue.indexOf(',') != -1) {
                propertyValue = propertyValue.replaceAll(",", "");
            }
            value = Short.valueOf(propertyValue);
        } else if ((type == Byte.class) || (type == byte.class)) {
            value = Byte.valueOf(propertyValue);
        } else if (type == java.util.Date.class) {
            value = DateUtils.toDate(propertyValue);
        } else if (type == java.sql.Date.class) {
            value = DateUtils.toDate(propertyValue);
        } else if (type == java.sql.Timestamp.class) {
            value = DateUtils.toDate(propertyValue);
        } else if (type.isAssignableFrom(List.class)) {
        } else if (type.isAssignableFrom(Set.class)) {
        } else if (type.isAssignableFrom(Collection.class)) {
        } else if (type.isAssignableFrom(Map.class)) {
        } else {
            value = propertyValue;
        }
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }
    return value;
}

From source file:arena.action.ServletRequestState.java

public Float getArg(String key, Float defaultValue) {
    Object arg = this.attributesMap.get(key);
    if (arg == null) {
        return defaultValue;
    } else if (arg instanceof Number) {
        return ((Number) arg).floatValue();
    } else {/*  w ww  .  j  a va  2s  . com*/
        return Float.valueOf(arg.toString());
    }
}

From source file:com.ikanow.aleph2.v1.document_db.utils.TestJsonNodeBsonUtils.java

@Test
public void test_transform() {
    final ObjectMapper mapper = BeanTemplateUtils.configureMapper(Optional.empty());
    new JsonNodeBsonUtils(); //coverage!

    assertEquals(NullNode.instance,//from w w w  .  j a  v  a2 s.  c om
            JsonNodeBsonUtils.transform(new HashSet<String>(), JsonNodeFactory.instance));
    assertEquals(null, JsonNodeBsonUtils.transform(null, JsonNodeFactory.instance));
    assertEquals(mapper.convertValue(true, JsonNode.class),
            JsonNodeBsonUtils.transform(true, JsonNodeFactory.instance));
    assertEquals(mapper.convertValue("test", JsonNode.class),
            JsonNodeBsonUtils.transform("test", JsonNodeFactory.instance));
    assertEquals(mapper.convertValue(4, JsonNode.class),
            JsonNodeBsonUtils.transform(4, JsonNodeFactory.instance));
    assertEquals(mapper.convertValue(4L, JsonNode.class),
            JsonNodeBsonUtils.transform(4L, JsonNodeFactory.instance));
    assertEquals(mapper.convertValue(new byte[] { (byte) 0xFF, (byte) 0xFE }, JsonNode.class),
            JsonNodeBsonUtils.transform(new byte[] { (byte) 0xFF, (byte) 0xFE }, JsonNodeFactory.instance));
    assertEquals(mapper.convertValue(4.0, JsonNode.class),
            JsonNodeBsonUtils.transform(4.0, JsonNodeFactory.instance));
    assertEquals(mapper.convertValue(0L, JsonNode.class),
            JsonNodeBsonUtils.transform(new Date(0L), JsonNodeFactory.instance));
    assertEquals(mapper.convertValue("4c927585d591d31d7b37097a", JsonNode.class),
            JsonNodeBsonUtils.transform(new ObjectId("4c927585d591d31d7b37097a"), JsonNodeFactory.instance));
    //(had real trouble creating a float node!)
    assertEquals(JsonNodeFactory.instance.numberNode(Float.valueOf((float) 4.0)),
            JsonNodeBsonUtils.transform((float) 4.0, JsonNodeFactory.instance));

    // will test object writable and array writable below      
}

From source file:com.ghy.common.orm.hibernate.HibernateDao.java

/**
 * /*from w ww .  j  a v  a  2 s.c o m*/
 * @param sql
 * @param params
 * @return
 */
public Float findBySqlFloat(String sql, Map<String, ?> params) {
    SQLQuery queryObject = getSession().createSQLQuery(sql);
    if (params != null && params.size() > 0)
        queryObject.setProperties(params);
    List<BigDecimal> qlist = queryObject.list();
    if (qlist != null && qlist.size() > 0) {
        BigDecimal obj = qlist.get(0);
        return obj.floatValue();
    }
    return Float.valueOf(0);
}

From source file:com.workday.autoparse.json.demo.JsonParserTest.java

private void testParse(String fileName) throws Exception {
    TestObject testObject = (TestObject) parser.parseJsonStream(getInputStream(fileName));
    assertNotNull("testObject", testObject);

    assertEquals("testObject.discriminationValue", "testObject", testObject.discriminationValue);
    assertEquals("testObject.superDiscriminationValue", "testObject", testObject.superDiscriminationValue);

    // Basic Types
    assertTrue("testObject.myBoolean", testObject.myBoolean);
    assertEquals("testObject.myByte", (byte) 65, testObject.myByte);
    assertEquals("testObject.myChar", 'c', testObject.myChar);
    assertEquals("testObject.myDouble", 12.34, testObject.myDouble, ERROR);
    assertEquals("testObject.myFloat", 123.45f, testObject.myFloat, ERROR);
    assertEquals("testObject.myInt", 12, testObject.myInt);
    assertEquals("testObject.myLong", 123456, testObject.myLong);
    assertEquals("testObject.myShort", 17, testObject.myShort);

    assertTrue("testObject.myBoxedBoolean", testObject.myBoxedBoolean);
    assertEquals("testObject.myBoxedByte", Byte.valueOf("63"), testObject.myBoxedByte);
    assertEquals("testObject.myBoxedChar", Character.valueOf('d'), testObject.myBoxedChar);
    assertEquals("testObject.myBoxedDouble", Double.valueOf("12.345"), testObject.myBoxedDouble);
    assertEquals("testObject.myBoxedFloat", Float.valueOf("123.456"), testObject.myBoxedFloat);
    assertEquals("testObject.myBoxedInt", Integer.valueOf("123"), testObject.myBoxedInt);
    assertEquals("testObject.myBoxedLong", Long.valueOf(1234567), testObject.myBoxedLong);
    assertEquals("testObject.myBoxedShort", new Short("18"), testObject.myBoxedShort);

    assertEquals("testObject.myString", "hello", testObject.myString);
    assertEquals("testObject.myBigDecimal", new BigDecimal("123456789.0123456789"), testObject.myBigDecimal);
    assertEquals("testObject.myBigInteger", new BigInteger("1234567891011"), testObject.myBigInteger);
    assertEquals("testObject.overriddenThing", 123, testObject.overriddenThing);
    assertNull("testObject.superOverriddenThing", testObject.superOverriddenThing);

    // Maps/* w ww.  j  a v a2s. c o  m*/
    assertNotNull("testObject.myStringMap", testObject.myStringMap);
    assertEquals("testObject.myStringMap.size", 2, testObject.myStringMap.size());
    assertEquals("testObject.myStringMap[key1]", "value1", testObject.myStringMap.get("key1"));
    assertEquals("testObject.myStringMap[key2]", "value2", testObject.myStringMap.get("key2"));

    assertNotNull("testObject.myTestObjectMap", testObject.myTestObjectMap);
    assertEquals("testObject.myTestObjectMap.size", 2, testObject.myTestObjectMap.size());
    assertEquals("testObject.myTestObjectMap[key1]", new SimpleTestObject("post-parse:string 1"),
            testObject.myTestObjectMap.get("key1"));
    assertEquals("testObject.myTestObjectMap[key2]", new SimpleTestObject("post-parse:string 2"),
            testObject.myTestObjectMap.get("key2"));

    assertNotNull("testObject.myInterfaceMap", testObject.myInterfaceMap);
    assertEquals("testObject.myInterfaceMap.size", 2, testObject.myInterfaceMap.size());
    assertEquals("testObject.myInterfaceMap[key1]", new TestObject.InnerTestObject("string 1"),
            testObject.myInterfaceMap.get("key1"));
    assertEquals("testObject.myInterfaceMap[key2]", new TestObject.InnerTestObject("string 2"),
            testObject.myInterfaceMap.get("key2"));

    assertNotNull("testObject.myObjectMap", testObject.myObjectMap);
    assertEquals("testObject.myObjectMap.size", 2, testObject.myTestObjectMap.size());
    assertEquals("testObject.myObjectMap[key1]",
            new SimpleTestObject("post-parse:string 1", "simpleTestObject"),
            testObject.myObjectMap.get("key1"));
    assertEquals("testObject.myObjectMap[key2]", "25", testObject.myObjectMap.get("key2"));

    // Collections
    assertEquals("testObject.myBooleanCollection", CollectionUtils.newHashSet(true, false, true),
            testObject.myBooleanCollection);
    assertEquals("testObject.myByteCollection", CollectionUtils.newHashSet((byte) 63, (byte) 64),
            testObject.myByteCollection);
    assertEquals("testObject.myCharCollection", new LinkedHashSet<>(CollectionUtils.newArrayList('d', 'e')),
            testObject.myCharCollection);
    assertEquals("testObject.myDoubleCollection",
            new LinkedList<>(CollectionUtils.newArrayList(12.345, 13.345)), testObject.myDoubleCollection);
    assertEquals("testObject.myFloatCollection", CollectionUtils.newArrayList(123.456f, 234.56f),
            testObject.myFloatCollection);
    assertEquals("testObject.myIntCollection", CollectionUtils.newArrayList(123, 456),
            testObject.myIntCollection);
    assertEquals("testObject.myLongCollection", CollectionUtils.newArrayList(1234567L, 2345678L),
            testObject.myLongCollection);
    assertEquals("testObject.myShortCollection", CollectionUtils.newArrayList((short) 18, (short) 19),
            testObject.myShortCollection);
    assertEquals("testObject.myStringCollection", CollectionUtils.newArrayList("hello", "there"),
            testObject.myStringCollection);
    assertEquals("testObject.myBigDecimalCollection", CollectionUtils
            .newArrayList(new BigDecimal("123456789.0123456789"), new BigDecimal("23456789.0123456789")),
            testObject.myBigDecimalCollection);
    assertEquals("testObject.myBigIntegerCollection",
            CollectionUtils.newArrayList(new BigInteger("1234567891011"), new BigInteger("234567891011")),
            testObject.myBigIntegerCollection);

    // Custom Objects
    SimpleTestObject singularChild = testObject.mySingularChild;
    assertNotNull("testObject.mySingularChild", singularChild);
    assertEquals("testObject.mySingularChild.myString", "post-parse:a singular child", singularChild.myString);
    assertTrue("testObject.mySingularChildByInterface instanceOf InnerTestObject",
            testObject.mySingularChildByInterface instanceof TestObject.InnerTestObject);
    assertEquals("testObject.mySingularChildByInterface.string", "an object",
            ((TestObject.InnerTestObject) (testObject.mySingularChildByInterface)).string);

    assertEquals("testObject.myInnerObject", new TestObject.InnerTestObject("an InnerTestObject"),
            testObject.myInnerObject);

    List<SimpleTestObject> list = testObject.myList;
    assertNotNull("testObject.myList", list);
    assertEquals("testObject.myList.size()", 2, list.size());
    assertEquals("testObject.myList[0].myString", "post-parse:list child 0", list.get(0).myString);
    assertEquals("testObject.myList[1].myString", "post-parse:list child 1", list.get(1).myString);

    assertNotNull("testObject.myListByInterface", testObject.myListByInterface);
    assertEquals("testObject.myListByInterface", 2, testObject.myListByInterface.size());
    assertTrue("testObject.myListByInterface[0] instanceOf InnerTestObject",
            testObject.myListByInterface.get(0) instanceof TestObject.InnerTestObject);
    assertEquals("testObject.myListByInterface[0]", "object 0",
            ((TestObject.InnerTestObject) (testObject.myListByInterface.get(0))).string);
    assertTrue("testObject.myListByInterface[1] instanceOf InnerTestObject",
            testObject.myListByInterface.get(1) instanceof TestObject.InnerTestObject);
    assertEquals("testObject.myListByInterface[1]", "object 1",
            ((TestObject.InnerTestObject) (testObject.myListByInterface.get(1))).string);

    List<List<Integer>> collectionOfCollections = testObject.myCollectionOfCollections;
    assertNotNull("testObject.collectionOfCollections", collectionOfCollections);
    assertEquals("testObject.collectionOfCollections.size()", 2, collectionOfCollections.size());
    assertEquals("testObject.collectionOfCollection[0]", CollectionUtils.newArrayList(1, 2),
            collectionOfCollections.get(0));
    assertEquals("testObject.collectionOfCollection[1]", CollectionUtils.newArrayList(3, 4),
            collectionOfCollections.get(1));

    List<Set<SimpleTestObject>> collectionOfCollectionUtilsOfTestObjects = testObject.mySetsOfTestObjects;
    assertNotNull("testObject.myCollectionUtilsOfTestObjects", collectionOfCollectionUtilsOfTestObjects);
    assertEquals("testObject.myCollectionUtilsOfTestObjects[0][0]",
            CollectionUtils.newHashSet(new SimpleTestObject("post-parse:set 0 child 0", "simpleTestObject"),
                    new SimpleTestObject("post-parse:set 0 child 1", "simpleTestObject")),
            collectionOfCollectionUtilsOfTestObjects.get(0));
    assertEquals("testObject.myCollectionUtilsOfTestObjects[0][0]",
            CollectionUtils.newHashSet(new SimpleTestObject("post-parse:set 1 child 0", "simpleTestObject"),
                    new SimpleTestObject("post-parse:set 1 child 1", "simpleTestObject")),
            collectionOfCollectionUtilsOfTestObjects.get(1));

    assertEquals("testObject.myUnannotatedObject", new UnannotatedObject("singular unannotated object"),
            testObject.myUnannotatedObject);

    assertEquals("testObject.myUnannotatedObjectCollection",
            CollectionUtils.newArrayList(new UnannotatedObject("unannotated item 0"),
                    new UnannotatedObject("unannotated item 1")),
            testObject.myUnannotatedObjectCollection);

    // JSON Natives
    assertNotNull("testObject.myJsonObject", testObject.myJsonObject);
    assertEquals("testObject.myJsonObject.getString(\"name\")", "value",
            testObject.myJsonObject.getString("name"));

    assertNotNull("testObject.myJsonArray", testObject.myJsonArray);
    assertEquals("testObject.myJsonArray.length()", 2, testObject.myJsonArray.length());
    assertEquals("testObject.myJsonArray[0].(\"name 0\")", "value 0",
            ((JSONObject) testObject.myJsonArray.get(0)).getString("name 0"));
    assertEquals("testObject.myJsonArray[1].(\"name 1\")", "value 1",
            ((JSONObject) testObject.myJsonArray.get(1)).getString("name 1"));

    assertNotNull("testObject.myJsonObjectCollection", testObject.myJsonObjectCollection);
    assertEquals("testObject.myJsonObjectCollection.size()", 2, testObject.myJsonObjectCollection.size());
    assertEquals("testObject.myJsonObjectCollection[0].(\"list name 0\")", "list value 0",
            testObject.myJsonObjectCollection.get(0).getString("list name 0"));
    assertEquals("testObject.myJsonObjectCollection[1].(\"list name 1\")", "list value 1",
            testObject.myJsonObjectCollection.get(1).getString("list name 1"));

    // Setters
    assertEquals("testObject.stringFromSetter", "string for setter", testObject.stringFromSetter);
    assertEquals("testObject.unannotatedObjectFromSetter",
            new UnannotatedObject("unannotated object for setter"), testObject.unannotatedObjectFromSetter);
    assertEquals("testObject.testObjectCollectionFromSetter",
            CollectionUtils.newArrayList(new ParserAnnotatedObject("object for list setter 0", null),
                    new ParserAnnotatedObject("object for list setter 1", null)),
            testObject.testObjectCollectionFromSetter);

    assertNotNull("testObject.integerCollectionsFromSetter", testObject.integerCollectionsFromSetter);
    assertEquals("testObject.integerCollectionsFromSetter.size()", 2,
            testObject.integerCollectionsFromSetter.size());
    assertEquals("testObject.integerCollectionsFromSetter.get(0)", CollectionUtils.newHashSet(1, 2),
            testObject.integerCollectionsFromSetter.get(0));
    assertEquals("testObject.integerCollectionsFromSetter.get(1)", CollectionUtils.newHashSet(3, 4),
            testObject.integerCollectionsFromSetter.get(1));

    // Empty Objects
    assertEquals("testObject.myEmptyObject", new SimpleTestObject(), testObject.myEmptyObject);
    assertNotNull("testObject.myEmptyCollection", testObject.myEmptyCollection);
    assertTrue("testObject.myEmptyCollection.isEmpty()", testObject.myEmptyCollection.isEmpty());

    // Nulls
    assertEquals("testObject.myNullInt", 1, testObject.myNullInt);
    assertNull("testObject.myNullString", testObject.myNullString);
    assertNull("testObject.myNullTestObject", testObject.myNullTestObject);
    assertNull("testObject.myNullCollection", testObject.myNullCollection);
    assertEquals("testObject.myDefaultCollection", Collections.singleton("the one"),
            testObject.myDefaultCollection);
}

From source file:com.linkedin.pinot.core.realtime.converter.stats.RealtimeNoDictionaryColStatistics.java

private void computeFloatMinMax(int[] rows) {
    float values[] = new float[_numDocIds];
    _blockValSet.getFloatValues(rows, 0, _numDocIds, values, 0);
    float min = Float.MAX_VALUE;
    float max = Float.MIN_VALUE;
    for (int i = 0; i < _numDocIds; i++) {
        if (values[i] < min) {
            min = values[i];//from w w w  .j  av a  2 s  .  co m
        }
        if (values[i] > max) {
            max = values[i];
        }
    }
    _minValue = Float.valueOf(min);
    _maxValue = Float.valueOf(max);
}

From source file:com.impetus.client.cassandra.common.CassandraUtilities.java

/**
 * @param value//from   w w  w. j  a va2 s .  c o m
 * @param f
 * @return
 */
public static ByteBuffer toBytes(Object value, Class<?> clazz) {
    if (clazz.isAssignableFrom(String.class)) {
        return UTF8Type.instance.decompose((String) value);
    } else if (clazz.equals(int.class) || clazz.isAssignableFrom(Integer.class)) {
        return Int32Type.instance.decompose(Integer.parseInt(value.toString()));
    } else if (clazz.equals(long.class) || clazz.isAssignableFrom(Long.class)) {
        return LongType.instance.decompose(Long.parseLong(value.toString()));
    } else if (clazz.equals(boolean.class) || clazz.isAssignableFrom(Boolean.class)) {
        return BooleanType.instance.decompose(Boolean.valueOf(value.toString()));
    } else if (clazz.equals(double.class) || clazz.isAssignableFrom(Double.class)) {
        return DoubleType.instance.decompose(Double.valueOf(value.toString()));
    } else if (clazz.isAssignableFrom(java.util.UUID.class)) {
        return UUIDType.instance.decompose(UUID.fromString(value.toString()));
    } else if (clazz.equals(float.class) || clazz.isAssignableFrom(Float.class)) {
        return FloatType.instance.decompose(Float.valueOf(value.toString()));
    } else if (clazz.isAssignableFrom(Date.class)) {
        DateAccessor dateAccessor = new DateAccessor();
        return DateType.instance.decompose((Date) value);
    } else {
        if (value.getClass().isAssignableFrom(String.class)) {
            value = PropertyAccessorFactory.getPropertyAccessor(clazz).fromString(clazz, value.toString());
        }
        return BytesType.instance
                .decompose(ByteBuffer.wrap(PropertyAccessorFactory.getPropertyAccessor(clazz).toBytes(value)));
    }
}