mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-18 14:58:47 +00:00
initial add of EbeanORM server based on v2.8.1
This commit is contained in:
1 parent
2b74d0f9d9
commit
96ce4c0ddf
1188 files changed
+135034
No files matched your search
@@ -0,0 +1,34 @@
|
||||
package com.avaje.ebeaninternal.server.persist;
|
||||
|
||||
import com.avaje.ebeaninternal.server.deploy.parse.DetectScala;
|
||||
|
||||
/**
|
||||
* Utility object with helper methods for DML.
|
||||
*/
|
||||
public class DmlUtil {
|
||||
|
||||
private static final boolean hasScalaSupport = DetectScala.hasScalaSupport();
|
||||
|
||||
/**
|
||||
* Return true if the value is null or a Numeric 0 (for primitive int's and long's) or Option empty.
|
||||
*/
|
||||
public static boolean isNullOrZero(Object value){
|
||||
if (value == null){
|
||||
return true;
|
||||
}
|
||||
|
||||
if (value instanceof Number){
|
||||
return ((Number)value).longValue() == 0l;
|
||||
}
|
||||
|
||||
if (hasScalaSupport){
|
||||
if (value instanceof scala.Option<?>) {
|
||||
if (((scala.Option<?>) value).isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user