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

com.groupbyinc.common.jackson.jq.internal.tree.SemicolonOperator Maven / Gradle / Ivy

There is a newer version: 198
Show newest version
package net.thisptr.jackson.jq.internal.tree;

import java.util.Collections;
import java.util.List;

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;

public class SemicolonOperator extends JsonQuery {
	private List qs;

	public SemicolonOperator(final List qs) {
		this.qs = qs;
	}

	@Override
	public List apply(final Scope scope, final JsonNode in) throws JsonQueryException {
		List result = Collections.emptyList();
		for (final JsonQuery q : qs)
			result = q.apply(scope, in);
		return result;
	}

	@Override
	public String toString() {
		final StringBuilder builder = new StringBuilder();
		String sep = "";
		for (final JsonQuery q : qs) {
			builder.append(sep);
			builder.append(q);
			sep = "; ";
		}
		return builder.toString();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy