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

org.etlunit.feature.RuntimeOptionDescriptorImpl Maven / Gradle / Ivy

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

public class RuntimeOptionDescriptorImpl implements RuntimeOptionDescriptor
{
	private final String name;
	private final String description;
	private final option_type optionType;
	private final boolean booleanValue;
	private final String stringValue;
	private final int intValue;

	public RuntimeOptionDescriptorImpl(String name, String description, boolean booleanValue)
	{
		this.name = name;
		this.description = description;
		this.booleanValue = booleanValue;
		this.stringValue = null;
		this.intValue = -1;

		optionType = option_type.bool;
	}

	public RuntimeOptionDescriptorImpl(String name, String description, String stringValue)
	{
		this.name = name;
		this.description = description;
		this.booleanValue = false;
		this.stringValue = stringValue;
		this.intValue = -1;

		optionType = option_type.string;
	}

	public RuntimeOptionDescriptorImpl(String name, String description, int integerValue)
	{
		this.name = name;
		this.description = description;
		this.booleanValue = false;
		this.stringValue = null;
		this.intValue = integerValue;

		optionType = option_type.integer;
	}

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

	@Override
	public String getDescription()
	{
		return description;
	}

	@Override
	public option_type getOptionType()
	{
		return optionType;
	}

	@Override
	public String getDefaultStringValue()
	{
		check(option_type.string);

		return stringValue;
	}

	@Override
	public boolean getDefaultBooleanValue()
	{
		check(option_type.bool);

		return booleanValue;
	}

	@Override
	public int getDefaultIntegerValue()
	{
		check(option_type.integer);

		return intValue;
	}

	private void check(option_type integer)
	{
		if (optionType != integer)
		{
			throw new IllegalArgumentException("Incorrect operation.");
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy