Example usage for com.vaadin.shared JsonConstants VTYPE_FLOAT

List of usage examples for com.vaadin.shared JsonConstants VTYPE_FLOAT

Introduction

In this page you can find the example usage for com.vaadin.shared JsonConstants VTYPE_FLOAT.

Prototype

String VTYPE_FLOAT

To view the source code for com.vaadin.shared JsonConstants VTYPE_FLOAT.

Click Source Link

Usage

From source file:org.vaadin.alump.offlinebuilder.client.offline.JsonEncoder.java

License:Open Source License

/**
 * Returns the transport type for the given value. Only returns a transport
 * type for internally handled values./*w  ww .  j a v  a  2s . c om*/
 *
 * @param value
 *            The value that should be transported
 * @return One of the JsonEncode.VTYPE_ constants or null if the value
 *         cannot be transported using an internally handled type.
 */
private static String getTransportType(Object value) {
    if (value == null) {
        return JsonConstants.VTYPE_NULL;
    } else if (value instanceof String) {
        return JsonConstants.VTYPE_STRING;
    } else if (value instanceof Connector) {
        return JsonConstants.VTYPE_CONNECTOR;
    } else if (value instanceof Boolean) {
        return JsonConstants.VTYPE_BOOLEAN;
    } else if (value instanceof Integer) {
        return JsonConstants.VTYPE_INTEGER;
    } else if (value instanceof Float) {
        return JsonConstants.VTYPE_FLOAT;
    } else if (value instanceof Double) {
        return JsonConstants.VTYPE_DOUBLE;
    } else if (value instanceof Long) {
        return JsonConstants.VTYPE_LONG;
    } else if (value instanceof List) {
        return JsonConstants.VTYPE_LIST;
    } else if (value instanceof Set) {
        return JsonConstants.VTYPE_SET;
    } else if (value instanceof String[]) {
        return JsonConstants.VTYPE_STRINGARRAY;
    } else if (value instanceof Object[]) {
        return JsonConstants.VTYPE_ARRAY;
    } else if (value instanceof Map) {
        return JsonConstants.VTYPE_MAP;
    } else if (value instanceof Enum<?>) {
        // Enum value is processed as a string
        return JsonConstants.VTYPE_STRING;
    }
    return null;
}