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

net.thisptr.jackson.jq.internal.tree.ModuleDirective Maven / Gradle / Ivy

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

import com.fasterxml.jackson.databind.JsonNode;

import net.thisptr.jackson.jq.Expression;
import net.thisptr.jackson.jq.internal.utils.ExpressionUtils;

public class ModuleDirective {
	private final JsonNode metadata;

	public ModuleDirective(final Expression metadataExr) {
		this.metadata = ExpressionUtils.evaluateLiteralExpression(metadataExr);
		if (metadata == null)
			throw new IllegalArgumentException("Module metadata must be constant");
		if (!metadata.isObject())
			throw new IllegalArgumentException("Module metadata must be an object");
	}

	@Override
	public String toString() {
		final StringBuilder s = new StringBuilder();
		s.append("module ");
		s.append(metadata);
		return s.toString();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy