void assertBound(Parameter<?> param) { if (!isBound(param)) { throw new IllegalStateException(_loc.get("param-not-bound", param, getQueryString(), getBoundParameterKeys()).getMessage()); } }
void assertBound(Parameter<?> param) { if (!isBound(param)) { throw new IllegalStateException(_loc.get("param-not-bound", param, getQueryString(), getBoundParameterKeys()).getMessage()); } }
void assertBound(Parameter<?> param) { if (!isBound(param)) { throw new IllegalStateException(_loc.get("param-not-bound", param, getQueryString(), getBoundParameterKeys()).getMessage()); } }
void assertBound(Parameter<?> param) { if (!isBound(param)) { throw new IllegalStateException(_loc.get("param-not-bound", param, getQueryString(), getBoundParameterKeys()).getMessage()); } }
/** * Return the value bound to the parameter. * * @param param * parameter object * @return parameter value * @throws IllegalStateException * if the parameter has not been been bound * @throws IllegalArgumentException * if the parameter does not belong to this query */ public <T> T getParameterValue(Parameter<T> p) { if (!isBound(p)) { throw new IllegalArgumentException(_loc.get("param-missing", p, getQueryString(), getBoundParameterKeys()) .getMessage()); } return (T) _boundParams.get(p); }
/** * Return the value bound to the parameter. * * @param param * parameter object * @return parameter value * @throws IllegalStateException * if the parameter has not been been bound * @throws IllegalArgumentException * if the parameter does not belong to this query */ public <T> T getParameterValue(Parameter<T> p) { if (!isBound(p)) { throw new IllegalArgumentException(_loc.get("param-missing", p, getQueryString(), getBoundParameterKeys()) .getMessage()); } return (T) _boundParams.get(p); }
} catch (Exception e) { throw new IllegalArgumentException(_loc.get("param-type-mismatch", new Object[] { param, getQueryString(), v, v.getClass().getName(), expectedType.getName() }) .getMessage()); if (!Filters.canConvert(v.getClass(), expectedType, true)) { throw new IllegalArgumentException(_loc.get("param-type-mismatch", new Object[] { param, getQueryString(), v, v.getClass().getName(), expectedType.getName() }) .getMessage()); } else {
/** * Return the value bound to the parameter. * * @param param * parameter object * @return parameter value * @throws IllegalStateException * if the parameter has not been been bound * @throws IllegalArgumentException * if the parameter does not belong to this query */ public <T> T getParameterValue(Parameter<T> p) { if (!isBound(p)) { throw new IllegalArgumentException(_loc.get("param-missing", p, getQueryString(), getBoundParameterKeys()) .getMessage()); } return (T) _boundParams.get(p); }
/** * Return the value bound to the parameter. * * @param param * parameter object * @return parameter value * @throws IllegalStateException * if the parameter has not been been bound * @throws IllegalArgumentException * if the parameter does not belong to this query */ public <T> T getParameterValue(Parameter<T> p) { if (!isBound(p)) { throw new IllegalArgumentException(_loc.get("param-missing", p, getQueryString(), getBoundParameterKeys()) .getMessage()); } return (T) _boundParams.get(p); }
/** * Get the positional parameter with the given position. The parameter may just have been declared and not bound to * a value. * * @param position * specified in the user query. * @return parameter object * @throws IllegalArgumentException * if the parameter with the given position does not exist */ public Parameter<?> getParameter(int pos) { if (_convertPositionalParams == true) { return getParameter("_" + String.valueOf(pos)); } Parameter<?> param = getDeclaredParameters().get(pos); if (param == null) throw new IllegalArgumentException(_loc.get("param-missing-pos", pos, getQueryString(), getDeclaredParameterKeys()).getMessage()); return param; }
/** * Get the positional parameter with the given position. The parameter may just have been declared and not bound to * a value. * * @param position * specified in the user query. * @return parameter object * @throws IllegalArgumentException * if the parameter with the given position does not exist */ public Parameter<?> getParameter(int pos) { if (_convertPositionalParams == true) { return getParameter("_" + String.valueOf(pos)); } Parameter<?> param = getDeclaredParameters().get(pos); if (param == null) throw new IllegalArgumentException(_loc.get("param-missing-pos", pos, getQueryString(), getDeclaredParameterKeys()).getMessage()); return param; }
/** * Get the positional parameter with the given position. The parameter may just have been declared and not bound to * a value. * * @param position * specified in the user query. * @return parameter object * @throws IllegalArgumentException * if the parameter with the given position does not exist */ public Parameter<?> getParameter(int pos) { if (_convertPositionalParams == true) { return getParameter("_" + String.valueOf(pos)); } Parameter<?> param = getDeclaredParameters().get(pos); if (param == null) throw new IllegalArgumentException(_loc.get("param-missing-pos", pos, getQueryString(), getDeclaredParameterKeys()).getMessage()); return param; }
/** * Get the positional parameter with the given position. The parameter may just have been declared and not bound to * a value. * * @param position * specified in the user query. * @return parameter object * @throws IllegalArgumentException * if the parameter with the given position does not exist */ public Parameter<?> getParameter(int pos) { if (_convertPositionalParams == true) { return getParameter("_" + String.valueOf(pos)); } Parameter<?> param = getDeclaredParameters().get(pos); if (param == null) throw new IllegalArgumentException(_loc.get("param-missing-pos", pos, getQueryString(), getDeclaredParameterKeys()).getMessage()); return param; }
/** * Get the parameter object corresponding to the declared parameter of the given name. This method is not required * to be supported for native queries. * * @throws IllegalArgumentException * if the parameter of the specified name does not exist * @throws IllegalStateException * if invoked on a native query */ public Parameter<?> getParameter(String name) { if (isNative()) { throw new IllegalStateException(_loc.get("param-named-non-native", name).getMessage()); } Parameter<?> param = getDeclaredParameters().get(name); if (param == null) { Set<ParameterExpression> exps = getDeclaredParameterKeys(ParameterExpression.class); for (ParameterExpression<?> e : exps) { if (name.equals(e.getName())) return e; } throw new IllegalArgumentException(_loc.get("param-missing-name", name, getQueryString(), getDeclaredParameterKeys()).getMessage()); } return param; }
/** * Get the parameter object corresponding to the declared parameter of the given name. This method is not required * to be supported for native queries. * * @throws IllegalArgumentException * if the parameter of the specified name does not exist * @throws IllegalStateException * if invoked on a native query */ public Parameter<?> getParameter(String name) { if (isNative()) { throw new IllegalStateException(_loc.get("param-named-non-native", name).getMessage()); } Parameter<?> param = getDeclaredParameters().get(name); if (param == null) { Set<ParameterExpression> exps = getDeclaredParameterKeys(ParameterExpression.class); for (ParameterExpression<?> e : exps) { if (name.equals(e.getName())) return e; } throw new IllegalArgumentException(_loc.get("param-missing-name", name, getQueryString(), getDeclaredParameterKeys()).getMessage()); } return param; }
/** * Get the parameter object corresponding to the declared parameter of the given name. This method is not required * to be supported for native queries. * * @throws IllegalArgumentException * if the parameter of the specified name does not exist * @throws IllegalStateException * if invoked on a native query */ public Parameter<?> getParameter(String name) { if (isNative()) { throw new IllegalStateException(_loc.get("param-named-non-native", name).getMessage()); } Parameter<?> param = getDeclaredParameters().get(name); if (param == null) { Set<ParameterExpression> exps = getDeclaredParameterKeys(ParameterExpression.class); for (ParameterExpression<?> e : exps) { if (name.equals(e.getName())) return e; } throw new IllegalArgumentException(_loc.get("param-missing-name", name, getQueryString(), getDeclaredParameterKeys()).getMessage()); } return param; }
/** * Sets the parameter of the given name to the given value. */ public OpenJPAQuery<X> setParameter(String name, Object value) { assertOpen(); _em.assertNotCloseInvoked(); lock(); try { // native queries can not have named parameters if (isNative()) { throw new IllegalArgumentException(_loc.get("no-named-params", name, getQueryString()).toString()); } else { bindValue(getParameter(name), value); } return this; } finally { unlock(); } }
/** * Sets the parameter of the given name to the given value. */ public OpenJPAQuery<X> setParameter(String name, Object value) { assertOpen(); _em.assertNotCloseInvoked(); lock(); try { // native queries can not have named parameters if (isNative()) { throw new IllegalArgumentException(_loc.get("no-named-params", name, getQueryString()).toString()); } else { bindValue(getParameter(name), value); } return this; } finally { unlock(); } }
/** * Sets the parameter of the given name to the given value. */ public OpenJPAQuery<X> setParameter(String name, Object value) { assertOpen(); _em.assertNotCloseInvoked(); lock(); try { // native queries can not have named parameters if (isNative()) { throw new IllegalArgumentException(_loc.get("no-named-params", name, getQueryString()).toString()); } else { bindValue(getParameter(name), value); } return this; } finally { unlock(); } }
/** * Sets the parameter of the given name to the given value. */ public OpenJPAQuery<X> setParameter(String name, Object value) { assertOpen(); _em.assertNotCloseInvoked(); lock(); try { // native queries can not have named parameters if (isNative()) { throw new IllegalArgumentException(_loc.get("no-named-params", name, getQueryString()).toString()); } else { bindValue(getParameter(name), value); } return this; } finally { unlock(); } }