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

jfxtras.icalendarfx.properties.calendar.Method Maven / Gradle / Ivy

The newest version!
package jfxtras.icalendarfx.properties.calendar;

import jfxtras.icalendarfx.VCalendar;
import jfxtras.icalendarfx.VElement;
import jfxtras.icalendarfx.properties.VPropertyBase;
import jfxtras.icalendarfx.properties.calendar.Method;
import jfxtras.icalendarfx.properties.calendar.Method.MethodType;
import jfxtras.icalendarfx.utilities.StringConverter;

/**
 * METHOD
 * RFC 5545, 3.7.2, page 77
 * 
 * This property defines the iCalendar object method associated with the calendar object.
 * 
 * No methods are defined by this specification.  This is the subject
 * of other specifications, such as the iCalendar Transport-
 * independent Interoperability Protocol (iTIP) defined by [2446bis]
 * 
 * Example:
 * METHOD:PUBLISH
 * 
 * @author David Bal
 * @see VCalendar
 */
public class Method extends VPropertyBase implements VElement
{
    private final static StringConverter CONVERTER = new StringConverter()
    {
        @Override
        public String toString(MethodType object)
        {
            return object.toString();
        }

        @Override
        public MethodType fromString(String string)
        {
            return MethodType.valueOf(string.toUpperCase());
        }
    };
    
    public Method(Method source)
    {
        super(source);
    }

    public Method(MethodType methodType)
    {
       super(methodType);
       setConverter(CONVERTER);
    }
    
    public Method()
    {
       super();
       setConverter(CONVERTER);
    }
    
    public static Method parse(String content)
    {
    	return Method.parse(new Method(), content);
    }
    
    /** Method types from RFC 5546 */
    public enum MethodType
    {
        PUBLISH,
        REQUEST,
        REPLY,
        ADD,
        CANCEL,
        REFRESH,
        COUNTER,
        DECLINECOUNTER;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy