Search in sources :

Example 6 with JsonValue

use of com.eclipsesource.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.eclipsesource.json.JsonValue)

Example 7 with JsonValue

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

the class JsonUtil method getLong.

/**
     * Returns a field in a Json object as a long.
     * 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 long
     */
public static long getLong(JsonObject object, String field) {
    final JsonValue value = object.get(field);
    throwExceptionIfNull(value, field);
    return value.asLong();
}
Also used : JsonValue(com.eclipsesource.json.JsonValue)

Example 8 with JsonValue

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

the class JsonUtil method getDouble.

/**
     * Returns a field in a Json object as a double.
     * 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 double
     */
public static double getDouble(JsonObject object, String field) {
    final JsonValue value = object.get(field);
    throwExceptionIfNull(value, field);
    return value.asDouble();
}
Also used : JsonValue(com.eclipsesource.json.JsonValue)

Example 9 with JsonValue

use of com.eclipsesource.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.eclipsesource.json.JsonValue)

Example 10 with JsonValue

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

the class JsonUtil method getInt.

/**
     * Returns a field in a Json object as an int.
     * 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 an int
     */
public static int getInt(JsonObject object, String field) {
    final JsonValue value = object.get(field);
    throwExceptionIfNull(value, field);
    return value.asInt();
}
Also used : JsonValue(com.eclipsesource.json.JsonValue)

Aggregations

JsonValue (com.eclipsesource.json.JsonValue)43 JsonObject (com.eclipsesource.json.JsonObject)19 JsonArray (com.eclipsesource.json.JsonArray)12 HashMap (java.util.HashMap)6 ParseException (com.eclipsesource.json.ParseException)4 IOException (java.io.IOException)4 InetSocketAddress (java.net.InetSocketAddress)3 Member (com.eclipsesource.json.JsonObject.Member)2 JsonUtil.getString (com.hazelcast.util.JsonUtil.getString)2 WalletCallException (com.vaklinov.zcashui.ZCashClientCaller.WalletCallException)2 FileInputStream (java.io.FileInputStream)2 InputStreamReader (java.io.InputStreamReader)2 Reader (java.io.Reader)2 PublicKey (java.security.PublicKey)2 X509EncodedKeySpec (java.security.spec.X509EncodedKeySpec)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 Map (java.util.Map)2 EndpointContext (org.eclipse.californium.elements.EndpointContext)2 Link (org.eclipse.leshan.Link)2