Code example for JSONObject

Methods: length, toString

0
     
    transient protected JSONObject    _engineConfig;
     
    protected EngineDependentOperation(JSONObject engineConfig) {
        _engineConfig = engineConfig;
        _engineConfigString = engineConfig == null || engineConfig.length() == 0
            ? null : engineConfig.toString();
    } 
     
    protected Engine createEngine(Project project) throws Exception {
        Engine engine = new Engine(project);
        engine.initializeFromJSON(getEngineConfig());
        return engine;
    } 
     
    protected JSONObject getEngineConfig() {
        if (_engineConfig == null && _engineConfigString != null) {
            try { 
                _engineConfig = ParsingUtilities.evaluateJsonStringToObject(_engineConfigString);
            } catch (JSONException e) {
                // ignore