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

org.etlunit.parser.ETLTestAnnotationImpl Maven / Gradle / Ivy

There is a newer version: 1.6.9
Show newest version
package org.etlunit.parser;

public class ETLTestAnnotationImpl extends ETLTestDebugTraceableImpl implements ETLTestAnnotation
{
	private final String name;
	private final ETLTestValueObject value;

	public ETLTestAnnotationImpl(String n, ETLTestValueObject v)
	{
		name = n;

		if (v.getValueType() != ETLTestValueObject.value_type.object)
		{
			throw new IllegalArgumentException("Cannot construct an annotation with any value type except for object");
		}

		value = v;
	}

	public ETLTestAnnotationImpl(String n, ETLTestValueObject v, Token t)
	{
		super(t);
		name = n;

		if (v.getValueType() != ETLTestValueObject.value_type.object)
		{
			throw new IllegalArgumentException("Cannot construct an annotation with any value type except for object");
		}

		value = v;
	}

	public ETLTestAnnotationImpl(String n)
	{
		name = n;
		value = null;
	}

	public ETLTestAnnotationImpl(String n, Token t)
	{
		super(t);
		name = n;
		value = null;
	}

	@Override
	public String getName()
	{
		return name;
	}

	@Override
	public boolean hasValue()
	{
		return value != null;
	}

	@Override
	public ETLTestValueObject getValue()
	{
		return value;
	}

	@Override
	public String toString()
	{
		return value != null ? (name + '(' + value.getJsonNode() + ')') : name;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy