io.unlogged.atomic.Expression Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unlogged-sdk Show documentation
Show all versions of unlogged-sdk Show documentation
Record java code execution with unlogged java sdk
package io.unlogged.atomic;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.IntNode;
public enum Expression {
SELF,
SIZE,
LENGTH;
public JsonNode compute(JsonNode actualValue) {
switch (this) {
case SELF:
return actualValue;
case SIZE:
return new IntNode(actualValue.size());
case LENGTH:
return new IntNode(actualValue.asText().length());
}
return actualValue;
}
}