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

jfxtras.icalendarfx.properties.component.descriptive.Priority Maven / Gradle / Ivy

There is a newer version: 17-r1
Show newest version
package jfxtras.icalendarfx.properties.component.descriptive;

import jfxtras.icalendarfx.components.VEvent;
import jfxtras.icalendarfx.components.VTodo;
import jfxtras.icalendarfx.properties.VPropertyBase;
import jfxtras.icalendarfx.properties.component.descriptive.Priority;

/**
 * PRIORITY
 * RFC 5545 iCalendar 3.8.1.9. page 89
 * 
 * This property defines the relative priority for a calendar component.
 * 
 * A value of 0 specifies an undefined priority.  A value of 1
 * is the highest priority.  A value of 2 is the second highest
 * priority.  Subsequent numbers specify a decreasing ordinal
 * priority.  A value of 9 is the lowest priority.
 *     
 * Example:
 * The following is an example of a property with the highest priority:
 * PRIORITY:1
 *  
 * @author David Bal
 * 
 * The property can be specified in following components:
 * @see VEvent
 * @see VTodo
 */
public class Priority extends VPropertyBase
{
    public Priority(Priority source)
    {
        super(source);
    }
    
    public Priority(Integer value)
    {
        super(value);
    }
    
    public Priority()
    {
        super();
    }

    @Override
    public void setValue(Integer value)
    {
        if ((value < 0) || (value > 9))
        {
            throw new IllegalArgumentException("Priority must between 0 and 9");
        }
        super.setValue(value);
    }
    
    @Override
    public boolean isValid()
    {
        return ((getValue() < 0) || (getValue() > 9)) ? false : super.isValid();
    }

    public static Priority parse(String content)
    {
    	return Priority.parse(new Priority(), content);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy