All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.unlogged.atomic.Expression Maven / Gradle / Ivy

There is a newer version: 0.7.6
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy