Search in sources :

Example 1 with Literal

use of io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.Literal in project deephaven-core by deephaven.

the class FilterValue method ofString.

@JsMethod(namespace = "dh.FilterValue")
public static FilterValue ofString(Object input) {
    Objects.requireNonNull(input);
    final String string;
    if (Js.typeof(input).equals("string")) {
        string = (String) input;
    } else {
        string = input.toString();
    }
    Literal lit = new Literal();
    lit.setStringValue(string);
    return new FilterValue(lit);
}
Also used : Literal(io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.Literal) JsMethod(jsinterop.annotations.JsMethod)

Example 2 with Literal

use of io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.Literal in project deephaven-core by deephaven.

the class FilterValue method ofBoolean.

@JsMethod(namespace = "dh.FilterValue")
public static FilterValue ofBoolean(Boolean b) {
    Objects.requireNonNull(b);
    Literal lit = new Literal();
    lit.setBoolValue(b);
    return new FilterValue(lit);
}
Also used : Literal(io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.Literal) JsMethod(jsinterop.annotations.JsMethod)

Example 3 with Literal

use of io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.Literal in project deephaven-core by deephaven.

the class FilterValue method ofNumber.

@JsMethod(namespace = "dh.FilterValue")
public static FilterValue ofNumber(Object input) {
    Objects.requireNonNull(input);
    if (input instanceof DateWrapper) {
        Literal lit = new Literal();
        lit.setNanoTimeValue(((DateWrapper) input).valueOf());
        return new FilterValue(lit);
    } else if (input instanceof LongWrapper) {
        Literal lit = new Literal();
        lit.setLongValue(((LongWrapper) input).valueOf());
        return new FilterValue(lit);
    } else if (Js.typeof(input).equals("number")) {
        Literal lit = new Literal();
        lit.setDoubleValue(Js.asDouble(input));
        return new FilterValue(lit);
    } else {
        // not sure what the input is, try to toString(), then parse to Double, and use that
        Literal lit = new Literal();
        lit.setDoubleValue(Double.parseDouble(input.toString()));
        return new FilterValue(lit);
    }
}
Also used : Literal(io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.Literal) LongWrapper(io.deephaven.web.client.api.LongWrapper) DateWrapper(io.deephaven.web.client.api.DateWrapper) JsMethod(jsinterop.annotations.JsMethod)

Aggregations

Literal (io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.Literal)3 JsMethod (jsinterop.annotations.JsMethod)3 DateWrapper (io.deephaven.web.client.api.DateWrapper)1 LongWrapper (io.deephaven.web.client.api.LongWrapper)1