com.groupbyinc.common.jackson.jq.internal.functions.NotFunction Maven / Gradle / Ivy
package net.thisptr.jackson.jq.internal.functions;
import java.util.Collections;
import java.util.List;
import net.thisptr.jackson.jq.Function;
import net.thisptr.jackson.jq.JsonQuery;
import net.thisptr.jackson.jq.Scope;
import net.thisptr.jackson.jq.exception.JsonQueryException;
import net.thisptr.jackson.jq.internal.BuiltinFunction;
import net.thisptr.jackson.jq.internal.misc.JsonNodeUtils;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.BooleanNode;
@BuiltinFunction("not/0")
public class NotFunction implements Function {
@Override
public List apply(final Scope scope, final List args, final JsonNode in) throws JsonQueryException {
return Collections. singletonList(BooleanNode.valueOf(!JsonNodeUtils.asBoolean(in)));
}
}