Example usage for com.vaadin.server JsonCodec decodeInternalType

List of usage examples for com.vaadin.server JsonCodec decodeInternalType

Introduction

In this page you can find the example usage for com.vaadin.server JsonCodec decodeInternalType.

Prototype

public static Object decodeInternalType(Type targetType, boolean restrictToInternalTypes,
        JsonValue encodedJsonValue, ConnectorTracker connectorTracker) 

Source Link

Document

Decodes a value that is of an internal type.

Usage

From source file:org.semanticsoft.vaaclipse.app.servlet.VaaclipseServerRpcHandler.java

License:Open Source License

private LegacyChangeVariablesInvocation parseLegacyChangeVariablesInvocation(String connectorId,
        String interfaceName, String methodName, LegacyChangeVariablesInvocation previousInvocation,
        JSONArray parametersJson, ConnectorTracker connectorTracker) throws JSONException {
    if (parametersJson.length() != 2) {
        throw new JSONException("Invalid parameters in legacy change variables call. Expected 2, was "
                + parametersJson.length());
    }/*from  w  w  w  .  ja  v  a2s. c  o  m*/
    String variableName = parametersJson.getString(0);
    UidlValue uidlValue = (UidlValue) JsonCodec.decodeInternalType(UidlValue.class, true, parametersJson.get(1),
            connectorTracker);

    Object value = uidlValue.getValue();

    if (previousInvocation != null && previousInvocation.getConnectorId().equals(connectorId)) {
        previousInvocation.setVariableChange(variableName, value);
        return null;
    } else {
        return new LegacyChangeVariablesInvocation(connectorId, variableName, value);
    }
}