mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-17 22:56:28 +00:00
#919 - io.ebean package initial
This commit is contained in:
1 parent
5821dc96b9
commit
971e2dc91b
2134 files changed
+10721
-8652
No files matched your search
@@ -0,0 +1,43 @@
|
||||
package io.ebeaninternal.server.expression;
|
||||
|
||||
import io.ebeaninternal.api.SpiNamedParam;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Helper for evaluating named parameters.
|
||||
*/
|
||||
class NamedParamHelp {
|
||||
|
||||
/**
|
||||
* Return the bind value taking into account named parameters.
|
||||
*/
|
||||
static Object value(Object val) {
|
||||
if (val instanceof SpiNamedParam) {
|
||||
return ((SpiNamedParam) val).getValue();
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value as a string.
|
||||
*/
|
||||
static String valueAsString(Object val) {
|
||||
Object value = value(val);
|
||||
return (value == null) ? null : value.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the potentially named parameter(s) to the values.
|
||||
*/
|
||||
public static void valueAdd(List<Object> values, Object sourceValue) {
|
||||
|
||||
Object value = value(sourceValue);
|
||||
if (value instanceof Collection) {
|
||||
values.addAll((Collection<?>) value);
|
||||
} else {
|
||||
values.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user