2003-05-20 03:25:31 +00:00

133 lines
4.3 KiB
Java

/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2002-03 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.dynamo;
import java.util.*;
import org.apache.commons.lang.enum.*;
/**
* A type-safe enumerated type that indicates the action of a {@link com.silverwrist.dynamo.iface.Request Request}
* that comes in from the framework. <CODE>Verb</CODE> objects correspond roughly to HTTP methods.
*
* @author Eric J. Bowersox &lt;erbo@silcom.com&gt;
* @version X
*/
public final class Verb extends Enum
{
/*--------------------------------------------------------------------------------
* The actual enumeration values
*--------------------------------------------------------------------------------
*/
/**
* Indicates a request to delete a resource identified by a URI. Corresponds to HTTP DELETE method.
*/
public static final Verb DELETE = new Verb("DELETE"); // (standard)
/**
* Indicates a request to retrieve a resource identified by a URI. Corresponds to HTTP GET method.
*/
public static final Verb GET = new Verb("GET"); // (standard)
/**
* Indicates a request to interact with a resource identified by a URI. Corresponds to HTTP POST method.
* All XML-RPC requests use this verb.
*/
public static final Verb POST = new Verb("POST"); // (standard)
/**
* Indicates a request to overwrite a resource identified by a URI. Corresponds to HTTP PUT method.
*/
public static final Verb PUT = new Verb("PUT"); // (standard)
/**
* Indicates a request to get the last modification time of a resource identified by a URI. Often associated
* with a HTTP GET method.
*/
public static final Verb _LASTMOD = new Verb("_LASTMOD"); // extended for getLastModified
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
/**
* Internal constructor which creates a new element of this enumerated type.
*
* @param name The name of the <CODE>Verb</CODE> to be created.
*/
private Verb(String name)
{
super(name);
} // end constructor
/*--------------------------------------------------------------------------------
* Standard static method implementations
*--------------------------------------------------------------------------------
*/
/**
* Gets a <CODE>Verb</CODE> by name.
*
* @param name The name of the <CODE>Verb</CODE> to get; may be <CODE>null</CODE>.
* @return The <CODE>Verb</CODE> object, or <CODE>null</CODE> if the <CODE>Verb</CODE> does not exist.
*/
public static Verb getEnum(String name)
{
return (Verb)getEnum(Verb.class,name);
} // end getEnum
/**
* Gets the <CODE>Map</CODE> of <CODE>Verb</CODE> objects by name.
*
* @return The <CODE>Verb</CODE> object <CODE>Map</CODE>.
*/
public static Map getEnumMap()
{
return getEnumMap(Verb.class);
} // end getEnumMap
/**
* Gets the <CODE>List</CODE> of <CODE>Verb</CODE> objects, in the order in which the objects are listed
* in the code above.
*
* @return The <CODE>Verb</CODE> object <CODE>List</CODE>.
*/
public static List getEnumList()
{
return getEnumList(Verb.class);
} // end getEnumList
/**
* Gets an iterator over all <CODE>Verb</CODE> objects, in the order in which the objects are listed
* in the code above.
*
* @return The <CODE>Verb</CODE> object iterator.
*/
public static Iterator iterator()
{
return iterator(Verb.class);
} // end iterator
} // end class Verb