Java tutorial
/* * 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. * * Contributor(s): */ package com.silverwrist.venice; import java.util.*; import org.apache.commons.lang.enum.*; /** * A type-safe enumerated type that indicates the visibility of a * {@link com.silverwrist.venice.iface.VeniceCommunity community}. * * @author Eric J. Bowersox <erbo@silcom.com> * @version X */ public final class CommunityVisibility extends Enum { /*-------------------------------------------------------------------------------- * The actual enumeration values *-------------------------------------------------------------------------------- */ /** * Indicates that the community is visible through both the hierarchical directory and searches. */ public static final CommunityVisibility SEARCHDIR = new CommunityVisibility("SEARCHDIR"); /** * Indicates that the community is visible through searches, but not the hierarchical directory. */ public static final CommunityVisibility SEARCHONLY = new CommunityVisibility("SEARCHONLY"); /** * Indicates that the community is visible through neither the hierarchical directory nor searches. */ public static final CommunityVisibility NONE = new CommunityVisibility("NONE"); /*-------------------------------------------------------------------------------- * Constructor *-------------------------------------------------------------------------------- */ /** * Internal constructor which creates a new element of this enumerated type. * * @param name The name of the <CODE>CommunityVisibility</CODE> to be created. */ private CommunityVisibility(String name) { super(name); } // end constructor /*-------------------------------------------------------------------------------- * Standard static method implementations *-------------------------------------------------------------------------------- */ /** * Gets a <CODE>CommunityVisibility</CODE> by name. * * @param name The name of the <CODE>CommunityVisibility</CODE> to get; may be <CODE>null</CODE>. * @return The <CODE>CommunityVisibility</CODE> object, or <CODE>null</CODE> if the <CODE>CommunityVisibility</CODE> * does not exist. */ public static CommunityVisibility getEnum(String name) { return (CommunityVisibility)getEnum(CommunityVisibility.class,name); } // end getEnum /** * Gets the <CODE>Map</CODE> of <CODE>CommunityVisibility</CODE> objects by name. * * @return The <CODE>CommunityVisibility</CODE> object <CODE>Map</CODE>. */ public static Map getEnumMap() { return getEnumMap(CommunityVisibility.class); } // end getEnumMap /** * Gets the <CODE>List</CODE> of <CODE>CommunityVisibility</CODE> objects, in the order in which the objects are * listed in the code above. * * @return The <CODE>CommunityVisibility</CODE> object <CODE>List</CODE>. */ public static List getEnumList() { return getEnumList(CommunityVisibility.class); } // end getEnumList /** * Gets an iterator over all <CODE>CommunityVisibility</CODE> objects, in the order in which the objects are listed * in the code above. * * @return The <CODE>CommunityVisibility</CODE> object iterator. */ public static Iterator iterator() { return iterator(CommunityVisibility.class); } // end iterator } // end class CommunityVisibility