com.groupbyinc.common.jackson.jq.internal.functions.AbstractAtFormattingFunction 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 com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.TextNode;
public abstract class AbstractAtFormattingFunction implements Function {
@Override
public List apply(Scope scope, List args, JsonNode in) throws JsonQueryException {
final String text = in.isTextual() ? in.asText() : in.toString();
return Collections. singletonList(new TextNode(convert(text)));
}
public abstract String convert(String text) throws JsonQueryException;
}