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

jfxtras.icalendarfx.parameters.ParameterEnumBasedWithUnknown Maven / Gradle / Ivy

There is a newer version: 17-r1
Show newest version
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