## org.opengis.util
Class CodeList<E extends CodeList<E>>

    Object
      CodeList<E>

All Implemented Interfaces:
  Serializable, Comparable<E>

Direct Known Subclasses:
  AssociationType, AxisDirection, BSplineSurfaceForm, ByteInValuePacking, CellGeometry, CharacterSet, Classification, ColorInterpretation, CommonPointRule, CoverageContentType, CurveInterpolation, Datatype, DateType, DimensionNameType, EvaluationMethodType, GeometricObjectType, ImagingCondition, IndeterminateValue, InitiativeType, InterpolationMethod, KeywordType, KnotType, MaintenanceFrequency, MediumFormat, MediumName, Obligation, OnLineFunction, PaletteInterpretation, PixelInCell, PixelOrientation, PrecisionType, PresentationForm, Progress, RangeMeaning, RelativePosition, Restriction, Role, SampleDimensionType, ScopeCode, SequenceType, SimpleEnumerationType, SortOrder, SpatialRepresentationType, SplineCurveForm, SurfaceInterpolation, TopicCategory, TopologyLevel, ValueInBytePacking, VerticalDatumType

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

extends Object
implements Comparable<E>, Serializable

Base class for all code lists. Subclasses shall provides a `values()` method which returns all `CodeList` element in an array of the appropriate class. Code list are extensible, i.e. invoking the public constructor in any subclass will automatically add the newly created `CodeList` element in the array to be returned by `values()`.

Since:
  GeoAPI 1.0
See Also:
  Serialized Form

Constructor Summary
`protected` `CodeList(String name, Collection<E> values)` Creates a new code list element and add it to the given collection.

Method Summary
`int` `compareTo(E other)` Compares this code with the specified object for order.
`abstract CodeList[]` `family()` Returns the list of enumerations of the same kind than this enum.
`String` `name()` Returns the name of this enum constant.
`int` `ordinal()` Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero).
`protected Object` `readResolve()` Resolves the code list to an unique instance after deserialization.
`String` `toString()` Returns a string representation of this code list.

Methods inherited from class Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### CodeList

    protected CodeList(String name,
                       Collection<E> values)

  Creates a new code list element and add it to the given collection. Subclasses will typically give a static reference to an `ArrayList` for the `values` argument. This list is used for `values()` method implementations.

  Parameters:
    `name` - The code name.
    `values` - The collection to add the element to.

Method Detail

### ordinal

    public final int ordinal()

  Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero).

### name

    public final String name()

  Returns the name of this enum constant.

### family

    public abstract CodeList[] family()

  Returns the list of enumerations of the same kind than this enum.

### compareTo

    public final int compareTo(E other)

  Compares this code with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

  Code list constants are only comparable to other code list constants of the same type. The natural order implemented by this method is the order in which the constants are declared.

  Specified by:
    `compareTo` in interface `Comparable<E extends CodeList<E>>`

### toString

    public String toString()

  Returns a string representation of this code list.

  Overrides:
    `toString` in class `Object`

### readResolve

    protected Object readResolve()
                          throws ObjectStreamException

  Resolves the code list to an unique instance after deserialization. The instance is resolved using its name only (not its ordinal).

  Returns:
    This code list as an unique instance.
  Throws:
    `ObjectStreamException` - if the deserialization failed.

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