@Override public void removeSourceLocation() { super.removeSourceLocation(); for (ModelASTMethodArg arg : args) { arg.removeSourceLocation(); } }
@Override public String toGroovy() { StringBuilder result = new StringBuilder("{\n"); for (Map.Entry<ModelASTKey, ModelASTMethodArg> entry : variables.entrySet()) { result.append(entry.getKey().toGroovy()).append(" ").append(entry.getValue().toGroovy()).append('\n'); } result.append("}\n"); return result.toString(); }
@Override public void validate(@Nonnull ModelValidator validator) { validator.validateElement(this); if (variables != null) { variables.validate(validator); } }
@Override public JSONObject toJSON() { final JSONObject j = new JSONObject(); j.accumulate("type", agentType.toJSON()); if (variables != null) { if (variables instanceof ModelASTClosureMap && !((ModelASTClosureMap) variables).getVariables().isEmpty()) { j.accumulate("arguments", variables.toJSON()); } else if (variables instanceof ModelASTValue) { j.accumulate("argument", variables.toJSON()); } } return j; }
@Override public JSONArray toJSON() { final JSONArray a = new JSONArray(); for (Map.Entry<ModelASTKey, ModelASTMethodArg> entry: variables.entrySet()) { JSONObject o = new JSONObject(); o.accumulate("key", entry.getKey().toJSON()); o.accumulate("value", entry.getValue().toJSON()); a.add(o); } return a; }
@Override public void validate(final ModelValidator validator) { for (Map.Entry<ModelASTKey, ModelASTMethodArg> entry : variables.entrySet()) { entry.getKey().validate(validator); entry.getValue().validate(validator); } }
@Override public JSONArray toJSON() { final JSONArray a = new JSONArray(); for (Map.Entry<ModelASTKey, ModelASTMethodArg> entry: variables.entrySet()) { JSONObject o = new JSONObject(); o.accumulate("key", entry.getKey().toJSON()); o.accumulate("value", entry.getValue().toJSON()); a.add(o); } return a; }
@Override public void removeSourceLocation() { super.removeSourceLocation(); for (ModelASTMethodArg arg : args) { arg.removeSourceLocation(); } }
@Override public String toGroovy() { StringBuilder result = new StringBuilder(name); result.append('('); boolean first = true; for (ModelASTMethodArg arg : args) { if (first) { first = false; } else { result.append(", "); } result.append(arg.toGroovy()); } result.append(')'); return result.toString(); }
@Override public void validate(final ModelValidator validator) { validator.validateElement(this); for (ModelASTMethodArg arg : args) { arg.validate(validator); } }
@Override public JSONObject toJSON() { return new JSONObject().accumulate("key", key.toJSON()).accumulate("value", value.toJSON()); }
@Override public void removeSourceLocation() { super.removeSourceLocation(); for (Map.Entry<ModelASTKey, ModelASTMethodArg> entry : variables.entrySet()) { entry.getKey().removeSourceLocation(); entry.getValue().removeSourceLocation(); } }
@Override public String toGroovy() { StringBuilder result = new StringBuilder("{\n"); for (Map.Entry<ModelASTKey, ModelASTMethodArg> entry : variables.entrySet()) { result.append(entry.getKey().toGroovy()).append(" ").append(entry.getValue().toGroovy()).append('\n'); } result.append("}\n"); return result.toString(); }
@Override public void validate(ModelValidator validator) { validator.validateElement(this); if (variables != null) { variables.validate(validator); } }
@Override public JSONObject toJSON() { return new JSONObject().accumulate("key", key.toJSON()).accumulate("value", value.toJSON()); }
@Override public void removeSourceLocation() { super.removeSourceLocation(); for (Map.Entry<ModelASTKey, ModelASTMethodArg> entry : variables.entrySet()) { entry.getKey().removeSourceLocation(); entry.getValue().removeSourceLocation(); } }
@Override public String toGroovy() { return key.toGroovy() + ": " + value.toGroovy(); }
@Override public void validate(@Nonnull final ModelValidator validator) { for (Map.Entry<ModelASTKey, ModelASTMethodArg> entry : variables.entrySet()) { entry.getKey().validate(validator); entry.getValue().validate(validator); } }
@Override public JSONObject toJSON() { final JSONObject j = new JSONObject(); // Handle JENKINS-43016 - round-trip empty-string label agent into agent any. if (isEmptyStringLabelAgent()) { j.accumulate("type", "any"); } else { j.accumulate("type", agentType.toJSON()); if (variables != null) { if (variables instanceof ModelASTClosureMap && !((ModelASTClosureMap) variables).getVariables().isEmpty()) { j.accumulate("arguments", variables.toJSON()); } else if (variables instanceof ModelASTValue) { j.accumulate("argument", variables.toJSON()); } } } return j; }
@Override public void removeSourceLocation() { super.removeSourceLocation(); key.removeSourceLocation(); value.removeSourceLocation(); }