org.opengis.util
Class SimpleEnumerationType<E extends SimpleEnumerationType<E>>

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

public abstract class SimpleEnumerationType<E extends SimpleEnumerationType<E>>
extends CodeList<E>

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
TODO:
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<E> values, String name, String description)
          Add a new SimpleEnumerationType to the given list using the given name and description.
protected SimpleEnumerationType(Collection<E> 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<E> 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<E> 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<E extends SimpleEnumerationType<E>>
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.


Copyright © 1994-2008 Open Geospatial Consortium. All Rights Reserved.