jfxtras.icalendarfx.parameters.ParameterEnumBasedWithUnknown Maven / Gradle / Ivy
package jfxtras.icalendarfx.parameters;
import java.util.Collections;
import java.util.List;
import jfxtras.icalendarfx.parameters.ParameterEnumBasedWithUnknown;
import jfxtras.icalendarfx.parameters.VParameterBase;
import jfxtras.icalendarfx.utilities.StringConverter;
public abstract class ParameterEnumBasedWithUnknown extends VParameterBase
{
private String nonStandardValue; // contains exact string for unknown value
/*
* CONSTRUCTORS
*/
public ParameterEnumBasedWithUnknown(StringConverter stringConverter)
{
super(stringConverter);
}
public ParameterEnumBasedWithUnknown(T value, StringConverter stringConverter)
{
this(stringConverter);
setValue(value);
}
public ParameterEnumBasedWithUnknown(ParameterEnumBasedWithUnknown source, StringConverter stringConverter)
{
super(source, stringConverter);
nonStandardValue = source.nonStandardValue;
}
@Override
String valueAsString()
{
return (getValue().toString().equals("UNKNOWN")) ? nonStandardValue : super.valueAsString();
}
@Override
protected List parseContent(String content)
{
super.parseContent(content);
if (getValue().toString().equals("UNKNOWN"))
{
String valueString = VParameterBase.extractValue(content);
nonStandardValue = valueString;
}
return Collections.EMPTY_LIST;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy