Search in sources :

Example 56 with JsonValue

use of com.hazelcast.internal.json.JsonValue in project hazelcast by hazelcast.

the class WanSyncConfigDTO method fromJson.

@Override
public void fromJson(JsonObject json) {
    config = new WanSyncConfig();
    JsonValue consistencyCheckStrategy = json.get("consistencyCheckStrategy");
    if (consistencyCheckStrategy != null && !consistencyCheckStrategy.isNull()) {
        config.setConsistencyCheckStrategy(ConsistencyCheckStrategy.getById((byte) consistencyCheckStrategy.asInt()));
    }
}
Also used : WanSyncConfig(com.hazelcast.config.WanSyncConfig) JsonValue(com.hazelcast.internal.json.JsonValue)

Example 57 with JsonValue

use of com.hazelcast.internal.json.JsonValue in project hazelcast by hazelcast.

the class LocalOperationStatsImpl method fromJson.

@Override
public void fromJson(JsonObject json) {
    maxVisibleSlowOperationCount = getLong(json, "maxVisibleSlowOperationCount", Long.MAX_VALUE);
    for (JsonValue jsonValue : getArray(json, "slowOperations")) {
        SlowOperationDTO slowOperationDTO = new SlowOperationDTO();
        slowOperationDTO.fromJson(jsonValue.asObject());
        slowOperations.add(slowOperationDTO);
    }
    creationTime = getLong(json, "creationTime", -1L);
}
Also used : JsonValue(com.hazelcast.internal.json.JsonValue) SlowOperationDTO(com.hazelcast.internal.management.dto.SlowOperationDTO)

Example 58 with JsonValue

use of com.hazelcast.internal.json.JsonValue in project hazelcast by hazelcast.

the class JsonUtil method getFloat.

/**
 * Returns a field in a Json object as a float.
 * Throws IllegalArgumentException if the field value is null.
 *
 * @param object the Json Object
 * @param field the field in the Json object to return
 * @return the Json field value as a float
 */
public static float getFloat(JsonObject object, String field) {
    final JsonValue value = object.get(field);
    throwExceptionIfNull(value, field);
    return value.asFloat();
}
Also used : JsonValue(com.hazelcast.internal.json.JsonValue)

Example 59 with JsonValue

use of com.hazelcast.internal.json.JsonValue in project hazelcast by hazelcast.

the class JsonUtil method getObject.

/**
 * Returns a field in a Json object as an object.
 * Throws IllegalArgumentException if the field value is null.
 *
 * @param object the Json object
 * @param field the field in the Json object to return
 * @return the Json field value as a Json object
 */
public static JsonObject getObject(JsonObject object, String field) {
    final JsonValue value = object.get(field);
    throwExceptionIfNull(value, field);
    return value.asObject();
}
Also used : JsonValue(com.hazelcast.internal.json.JsonValue)

Example 60 with JsonValue

use of com.hazelcast.internal.json.JsonValue in project hazelcast by hazelcast.

the class JsonUtil method getBoolean.

/**
 * Returns a field in a Json object as a boolean.
 * Throws IllegalArgumentException if the field value is null.
 *
 * @param object the Json Object
 * @param field the field in the Json object to return
 * @return the Json field value as a boolean
 */
public static boolean getBoolean(JsonObject object, String field) {
    final JsonValue value = object.get(field);
    throwExceptionIfNull(value, field);
    return value.asBoolean();
}
Also used : JsonValue(com.hazelcast.internal.json.JsonValue)

Aggregations

JsonValue (com.hazelcast.internal.json.JsonValue)85 Test (org.junit.Test)36 JsonObject (com.hazelcast.internal.json.JsonObject)35 QuickTest (com.hazelcast.test.annotation.QuickTest)30 JsonArray (com.hazelcast.internal.json.JsonArray)28 HazelcastJsonValue (com.hazelcast.core.HazelcastJsonValue)25 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)20 ArrayList (java.util.ArrayList)9 HashMap (java.util.HashMap)8 HazelcastInstance (com.hazelcast.core.HazelcastInstance)6 KubernetesApiProvider.convertToString (com.hazelcast.kubernetes.KubernetesApiProvider.convertToString)6 EndpointAddress (com.hazelcast.kubernetes.KubernetesClient.EndpointAddress)6 HashSet (java.util.HashSet)6 ConnectionResponse (com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse)5 SlowTest (com.hazelcast.test.annotation.SlowTest)5 Address (com.hazelcast.cluster.Address)4 CPMember (com.hazelcast.cp.CPMember)4 IOException (java.io.IOException)4 JsonUtil.fromJsonObject (com.hazelcast.internal.util.JsonUtil.fromJsonObject)3 JsonUtil.getString (com.hazelcast.internal.util.JsonUtil.getString)3