org.onetwo.common.db.sqlext.ExtQuery Maven / Gradle / Ivy
The newest version!
package org.onetwo.common.db.sqlext;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import org.onetwo.common.db.sqlext.ExtQuery.K.IfNull;
import lombok.Builder;
import lombok.Data;
public interface ExtQuery {
public static class Msg {
public static final String THROW_IF_NULL_MSG = "the case value can not be null!";
}
@Data
static public class KeyObject {
public static KeyObject or() {
KeyObject or = KeyObject.builder().key(":or").id(System.currentTimeMillis()).build();
return or;
};
public static KeyObject and() {
KeyObject or = KeyObject.builder().key(":or").id(System.currentTimeMillis()).build();
return or;
};
final private String key;
final private Long id;
@Builder
private KeyObject(String key, Long id) {
super();
this.key = key;
this.id = id;
}
public String key() {
return key;
}
public String withkey(Object value) {
return key + ":" + value;
}
public String keyFunc(String arg) {
return key + "(" + arg + ")";
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
KeyObject other = (KeyObject) obj;
return Objects.equals(id, other.id) && Objects.equals(key, other.key);
}
@Override
public int hashCode() {
return Objects.hash(id, key);
}
}
/****
* key object set
* @author way
*
*/
final public static class K {
public static enum IfNull {
Calm,//not throw , not ignore
Throw,
Ignore
}
static final Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy