org.nustaq.reallive.query.Value Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of reallive Show documentation
Show all versions of reallive Show documentation
persistent inmemory datagrid based on kontraktor
package org.nustaq.reallive.query;
import java.io.Serializable;
/**
* Created by moelrue on 27.08.2015.
*/
public interface Value extends Serializable, HasToken {
Value TRUE = new LongValue(1, null);
Value FALSE = new LongValue(0, null);
QToken getToken();
double getDoubleValue();
long getLongValue();
String getStringValue();
default Object[] getArrayValue() {
return new Object[] { getValue() };
}
Object getValue();
default boolean isDouble() {
return this instanceof DoubleValue;
}
default boolean isLong() {
return this instanceof LongValue;
}
default boolean isString() {
return this instanceof StringValue;
}
default boolean isArray() { return this instanceof ArrayValue; }
default boolean isTrue() {
if (isString()) {
String sv = getStringValue();
return !"false".equals(sv) && sv.length() > 0 && !"0".equals(sv);
}
return getLongValue() != 0;
}
Value negate();
boolean isEmpty();
}