Package com.eclipsesource.json

Examples of com.eclipsesource.json.JsonValue


        throwExceptionIfNull(value, field);
        return value.asString();
    }

    public static String getString(JsonObject object, String field, String defaultValue) {
        final JsonValue value = object.get(field);
        if (value == null) {
            return defaultValue;
        } else {
            return value.asString();
        }
    }
View Full Code Here


            return value.asString();
        }
    }

    public static boolean getBoolean(JsonObject object, String field) {
        final JsonValue value = object.get(field);
        throwExceptionIfNull(value, field);
        return value.asBoolean();
    }
View Full Code Here

        throwExceptionIfNull(value, field);
        return value.asBoolean();
    }

    public static boolean getBoolean(JsonObject object, String field, boolean defaultValue) {
        final JsonValue value = object.get(field);
        if (value == null) {
            return defaultValue;
        } else {
            return value.asBoolean();
        }
    }
View Full Code Here

            return value.asBoolean();
        }
    }

    public static JsonArray getArray(JsonObject object, String field) {
        final JsonValue value = object.get(field);
        throwExceptionIfNull(value, field);
        return value.asArray();
    }
View Full Code Here

        throwExceptionIfNull(value, field);
        return value.asArray();
    }

    public static JsonArray getArray(JsonObject object, String field, JsonArray defaultValue) {
        final JsonValue value = object.get(field);
        if (value == null) {
            return defaultValue;
        } else {
            return value.asArray();
        }
    }
View Full Code Here

            return value.asArray();
        }
    }

    public static JsonObject getObject(JsonObject object, String field) {
        final JsonValue value = object.get(field);
        throwExceptionIfNull(value, field);
        return value.asObject();
    }
View Full Code Here

        throwExceptionIfNull(value, field);
        return value.asObject();
    }

    public static JsonObject getObject(JsonObject object, String field, JsonObject defaultValue) {
        final JsonValue value = object.get(field);
        if (value == null) {
            return defaultValue;
        } else {
            return value.asObject();
        }
    }
View Full Code Here

      throw new NullPointerException( "configuration is null" );
    }
    Context context = Context.enter();
    try {
      ScriptableObject scope = context.initStandardObjects();
      JsonValue globalsValue = configuration.get( "globals" );
      if( globalsValue != null ) {
        String globalsExpr = "globals = " + globalsValue.toString() + ";";
        globals = context.evaluateString( scope, globalsExpr, "[globals]", 1, null );
      }
      configuration.remove( "globals" );
      String optionsExpr = "options = " + configuration.toString() + ";";
      options = context.evaluateString( scope, optionsExpr, "[options]", 1, null );
View Full Code Here

      Context.exit();
    }
  }

  private int determineIndent( JsonObject configuration ) {
    JsonValue value = configuration.get( "indent" );
    if( value != null && value.isNumber() ) {
      return value.asInt();
    }
    return DEFAULT_JSHINT_INDENT;
  }
View Full Code Here

      if( key.length() > 0 ) {
        if( parts.length != 2 ) {
          // TODO handle error
        } else {
          try {
            JsonValue value = JsonValue.readFrom( parts[ 1 ].trim() );
            result.add( new Entry( key, value ) );
          } catch( ParseException exception ) {
            // TODO handle error
          }
        }
View Full Code Here

TOP

Related Classes of com.eclipsesource.json.JsonValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.