public void internalSetConfigurationType(final ConfigurationType type) { this.configurationType = type; if (this.configurationType.isIn(ConfigurationType.STRING, ConfigurationType.BOOLEAN, ConfigurationType.TEXT, ConfigurationType.TIME_ZONE) == true) { this.intValue = null; this.floatValue = null; } else if (this.configurationType.isIn(ConfigurationType.INTEGER, ConfigurationType.TASK) == true) { this.stringValue = null; this.floatValue = null; } else if (this.configurationType.isIn(ConfigurationType.INTEGER, ConfigurationType.CALENDAR) == true) { this.stringValue = null; this.floatValue = null; } else if (this.configurationType.isIn(ConfigurationType.FLOAT, ConfigurationType.PERCENT) == true) { this.stringValue = null; this.intValue = null; } else { throw new UnsupportedOperationException("Unkown type: " + type); } }
protected void checkType(final ConfigurationType type) { if (this.configurationType != null) { if (this.configurationType == type) { return; } else if (type == ConfigurationType.STRING && this.configurationType.isIn(ConfigurationType.TEXT, ConfigurationType.BOOLEAN, ConfigurationType.TIME_ZONE) == true) { return; } else if (type == ConfigurationType.INTEGER && this.configurationType == ConfigurationType.TASK) { return; } else if (type == ConfigurationType.INTEGER && this.configurationType == ConfigurationType.CALENDAR) { return; } else if (type == ConfigurationType.FLOAT && this.configurationType == ConfigurationType.PERCENT) { return; } } throw new UnsupportedOperationException("Configuration object of type '" + this.configurationType + "' does not support value of type '" + type + "'!"); }
protected ConfigurationDO setType(final ConfigurationType type) { if (this.configurationType == null) { this.configurationType = type; } else if (this.configurationType == type) { // Do nothing. } else if (type == ConfigurationType.STRING && this.configurationType.isIn(ConfigurationType.TEXT, ConfigurationType.BOOLEAN, ConfigurationType.TIME_ZONE) == true) { // Do nothing. } else if (type == ConfigurationType.INTEGER && this.configurationType == ConfigurationType.TASK) { // Do nothing. } else if (type == ConfigurationType.INTEGER && this.configurationType == ConfigurationType.CALENDAR) { // Do nothing. } else if (type == ConfigurationType.FLOAT && this.configurationType == ConfigurationType.PERCENT) { // Do nothing. } else { throw new UnsupportedOperationException("Configuration object of type '" + this.configurationType + "' cannot be changed to type '" + type + "'!"); } return this; }
@Transient public Object getValue() { if (this.configurationType.isIn(ConfigurationType.STRING, ConfigurationType.TEXT, ConfigurationType.TIME_ZONE) == true) { return this.stringValue; } else if (this.configurationType == ConfigurationType.INTEGER || this.configurationType == ConfigurationType.TASK || this.configurationType == ConfigurationType.CALENDAR) { return this.intValue; } else if (this.configurationType == ConfigurationType.FLOAT || this.configurationType == ConfigurationType.PERCENT) { return this.floatValue; } else if (this.configurationType == ConfigurationType.BOOLEAN) { return this.getBooleanValue(); } else { throw new UnsupportedOperationException("Unsupported value type: " + this.configurationType); } }
configuration.setConfigurationType(param.getType()); configuration.setGlobal(param.isGlobal()); if (param.getType().isIn(ConfigurationType.STRING, ConfigurationType.TEXT) == true) { configuration.setValue(param.getDefaultStringValue()); if (param.getType().isIn(ConfigurationType.INTEGER)) { configuration.setIntValue(param.getDefaultIntValue()); if (param.getType().isIn(ConfigurationType.BOOLEAN)) { configuration.setStringValue(String.valueOf(param.getDefaultBooleanValue()));
public Object getValue(final IConfigurationParam parameter, final ConfigurationDO configurationDO) if (parameter.getType().isIn(ConfigurationType.STRING, ConfigurationType.TEXT) == true) { if (configurationDO == null) { return parameter.getDefaultStringValue(); return parameter.getDefaultStringValue(); } else if (parameter.getType().isIn(ConfigurationType.FLOAT, ConfigurationType.PERCENT) == true) { if (configurationDO == null) { return BigDecimal.ZERO;