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

io.rtdi.bigdata.connector.properties.atomic.PropertyBoolean Maven / Gradle / Ivy

package io.rtdi.bigdata.connector.properties.atomic;

import io.rtdi.bigdata.connector.pipeline.foundation.exceptions.PropertiesException;

public class PropertyBoolean extends PropertyAbstract implements IPropertyValue {
	protected Boolean value;

	public PropertyBoolean() {
		super();
	}
	
	public PropertyBoolean(String name, Boolean value) {
		this(name, null, null, null, value, null);
	}
	
	public PropertyBoolean(String name, String displayname, String description, String icon, Boolean defaultvalue, Boolean mandatory) {
		super(name, displayname, description, icon, mandatory);
		setValue(defaultvalue);
	}

	public void setValue(Boolean value) {
		this.value = value;
	}

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

	@Override
	public void parseValue(IProperty property, boolean ignorepasswords) throws PropertiesException {
		if (property instanceof PropertyBoolean) {
			this.value = ((PropertyBoolean) property).getValue();
		} else {
			throw new PropertiesException("PropertyBoolean's value not of type PropertyBoolean");
		}
	}

	@Override
	public String toString() {
		return String.valueOf(value);
	}

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

	@Override
	public IProperty clone(boolean ignorepasswords) {
		return new PropertyBoolean(this.getName(), this.getDisplayname(), this.getDescription(), this.getIcon(), this.getValue(), this.getMandatory());
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy