/** * get the Object value for this name argument. Returns null even if no * QueryParameter is associated with the name (no exception). */ public Object value(String name) { QueryParameter p = params.get(name); return p == null ? null : p.value; }
/** * get the {@link QueryParameter} for this name argument. */ public QueryParameter get(String name) { return params.get(name); }
public void params(Parameters params2) { if (params2 != null) { for (String key : params2.keySet()) { Object o = params2.get(key).value; if (o instanceof Collection) { paramList(key, (Collection) o); } else { param(key, o); } } } }
/** * check the {@link Parameters} instance against the {@link Definitions} * instance for this Query. Can be extended by subclasses, but * <code>super.checkParameters()</code> should most likely be called. */ protected void checkParameters() { if (defs == null) { throw new IllegalStateException( "Query parameter definitions not set."); } if (params == null) { throw new IllegalArgumentException("Null arrays " + "are not valid for definitions."); } Set<String> missing = new HashSet<String>(); for (String name : defs.keySet()) { if (!defs.get(name).optional && !params.keySet().contains(name)) { missing.add(name); } } if (missing.size() > 0) { throw new IllegalArgumentException( "Required parameters missing from query: " + missing); } for (String name : defs.keySet()) { QueryParameter parameter = params.get(name); QueryParameterDef def = defs.get(name); def.errorIfInvalid(parameter); } }
qp = null; } else { qp = _p.get("IDLIST");