GeoAPI 2.0
Build 2005-06-08

org.opengis.util
Class SimpleEnumerationType

Object
  extended by CodeList
      extended by SimpleEnumerationType
All Implemented Interfaces:
Serializable, Comparable
Direct Known Subclasses:
ArrowStyle, FillPattern, FillStyle, GraphicArc.ArcClosure, LineCap, LineJoin, LinePattern, LineStyle, Mark, PathType, XAnchor, YAnchor

public abstract class SimpleEnumerationType
extends CodeList

Class that implements simple, type safe enumerations in Java. Two enumeration values are equal if e1 == e2 or if e1.getValue() == e2.getValue().

Since:
GeoAPI 1.0
See Also:
Serialized Form

REVISIT OPEN ISSUE (a GeoAPI comment)
The name doesn't said what is the difference between this class and CodeList. Furthermore, according ISO 19103, enumeration and code list are not the same thing. This base class is closer to a code list than an enumeration.

Constructor Summary
protected SimpleEnumerationType(Collection values, String name, String description)
          Add a new SimpleEnumerationType to the given list using the given name and description.
protected SimpleEnumerationType(Collection values, String name, String description, Icon icon)
          Add a new SimpleEnumerationType to the given list using the given name and description.
 
Method Summary
 String getDescription()
          Gets the description for this enumeration value.
 Icon getIcon()
          Gets the icon for this enumeration value.
static Icon getNullIcon()
          Gets the null icon.
protected static Icon loadIconResource(Class a_class, String name)
          Load an icon for this enumeration.
 String toString()
          Gets the string representation of this object.
 
Methods inherited from class CodeList
compareTo, family, name, ordinal, readResolve
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleEnumerationType

protected SimpleEnumerationType(Collection values,
                                String name,
                                String description)
Add a new SimpleEnumerationType to the given list using the given name and description. The icon will be set to the Null Icon.

Parameters:
values - the list of values to add to.
name - the short name for the enum.
description - the description for the enum.

SimpleEnumerationType

protected SimpleEnumerationType(Collection values,
                                String name,
                                String description,
                                Icon icon)
Add a new SimpleEnumerationType to the given list using the given name and description.

Parameters:
values - the list of values to add to.
name - the short name for the enum.
description - the description for the enum.
icon - the icon for the enum.
Method Detail

loadIconResource

protected static Icon loadIconResource(Class a_class,
                                       String name)
Load an icon for this enumeration. loadIconResource loads the icon found by a_class.getResource(name).

Parameters:
a_class - class to use to find icon resource.
name - name of icon resource, for example, "SOLID.gif"
Returns:
a loaded icon for this enumeration. When no icon can be found the null icon is returned.
See Also:
getNullIcon()

getNullIcon

public static Icon getNullIcon()
Gets the null icon.

Returns:
a singleton icon that can be used when no icon was found in loadIconResource. The null icon is a fixed size, 16x64, and its paint method simply returns.

toString

public String toString()
Gets the string representation of this object. This just calls CodeList.name().

Overrides:
toString in class CodeList
Returns:
the string representation.

getDescription

public String getDescription()
Gets the description for this enumeration value.

Returns:
the description.

getIcon

public Icon getIcon()
Gets the icon for this enumeration value.

Returns:
the icon.

GeoAPI 2.0
Build 2005-06-08

Symbols, terms and definitions
Copyright OpenGIS® Consortium