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) 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 capabilities of a browser. These objects are returned * in a set by the {@link com.silverwrist.dynamo.iface.BrowserData#getBrowserFlags() BrowserData.getBrowserFlags()} * method. * * @author Eric J. Bowersox <erbo@silcom.com> * @version X */ public final class BrowserFlag extends Enum { /*-------------------------------------------------------------------------------- * The actual enumeration values *-------------------------------------------------------------------------------- */ /** * Indicates that the browser supports frames (the <FRAMESET> and <FRAME> tags). */ public static final BrowserFlag FRAMES = new BrowserFlag("FRAMES"); /** * Indicates that the browser supports in-line frames (the <IFRAME> tag). */ public static final BrowserFlag IFRAMES = new BrowserFlag("IFRAMES"); /** * Indicates that the browser supports tables. */ public static final BrowserFlag TABLES = new BrowserFlag("TABLES"); /** * Indicates that the browser supports cookies. */ public static final BrowserFlag COOKIES = new BrowserFlag("COOKIES"); /** * Indicates that the browser supports background sounds (the <BGSOUND> tag). */ public static final BrowserFlag BACKGROUND_SOUNDS = new BrowserFlag("BACKGROUND_SOUNDS"); /** * Indicates that the browser supports client-side scripting using Visual Basic Script. */ public static final BrowserFlag VBSCRIPT = new BrowserFlag("VBSCRIPT"); /** * Indicates that the browser supports client-side scripting using JavaScript (JScript). */ public static final BrowserFlag JAVASCRIPT = new BrowserFlag("JAVASCRIPT"); /** * Indicates that the browser supports client-side Java applets. */ public static final BrowserFlag JAVA_APPLETS = new BrowserFlag("JAVA_APPLETS"); /** * Indicates that the browser supports client-side ActiveX controls. */ public static final BrowserFlag ACTIVEX_CONTROLS = new BrowserFlag("ACTIVEX_CONTROLS"); /** * Indicates that the browser supports CDF. */ public static final BrowserFlag CDF = new BrowserFlag("CDF"); /** * Indicates that this browser is an America Online client. */ public static final BrowserFlag AOL = new BrowserFlag("AOL"); /** * Indicates that this browser is a beta version. */ public static final BrowserFlag BETA = new BrowserFlag("BETA"); /** * Indicates that the browser is running on a 16-bit Windows operating system. */ public static final BrowserFlag WIN16 = new BrowserFlag("WIN16"); /** * Indicates that this browser is not a browser at all, but a "crawler," which may be used to index the * site's content by a search engine, or for other (nefarious) purposes. */ public static final BrowserFlag CRAWLER = new BrowserFlag("CRAWLER"); /** * Indicates that this browser is not a browser at all, but a "stripper," which is copying the HTML of the * site to another location. This may or may not be benign. */ public static final BrowserFlag STRIPPER = new BrowserFlag("STRIPPER"); /** * Indicates that the browser is a cellphone or other handheld device, possibly supporting * Wireless Access Protocol (WAP). */ public static final BrowserFlag WAP = new BrowserFlag("WAP"); /*-------------------------------------------------------------------------------- * Constructor *-------------------------------------------------------------------------------- */ /** * Internal constructor which creates a new element of this enumerated type. * * @param name The name of the <CODE>BrowserFlag</CODE> to be created. */ private BrowserFlag(String name) { super(name); } // end constructor /*-------------------------------------------------------------------------------- * Standard static method implementations *-------------------------------------------------------------------------------- */ /** * Gets a <CODE>BrowserFlag</CODE> by name. * * @param name The name of the <CODE>BrowserFlag</CODE> to get; may be <CODE>null</CODE>. * @return The <CODE>BrowserFlag</CODE> object, or <CODE>null</CODE> if the <CODE>BrowserFlag</CODE> does not exist. */ public static BrowserFlag getEnum(String name) { return (BrowserFlag)getEnum(BrowserFlag.class,name); } // end getEnum /** * Gets the <CODE>Map</CODE> of <CODE>BrowserFlag</CODE> objects by name. * * @return The <CODE>BrowserFlag</CODE> object <CODE>Map</CODE>. */ public static Map getEnumMap() { return getEnumMap(BrowserFlag.class); } // end getEnumMap /** * Gets the <CODE>List</CODE> of <CODE>BrowserFlag</CODE> objects, in the order in which the objects are listed * in the code above. * * @return The <CODE>BrowserFlag</CODE> object <CODE>List</CODE>. */ public static List getEnumList() { return getEnumList(BrowserFlag.class); } // end getEnumList /** * Gets an iterator over all <CODE>BrowserFlag</CODE> objects, in the order in which the objects are listed * in the code above. * * @return The <CODE>BrowserFlag</CODE> object iterator. */ public static Iterator iterator() { return iterator(BrowserFlag.class); } // end iterator } // end class BrowserFlag