## org.opengis.util
Interface GenericName

All Superinterfaces:
  Comparable<GenericName>

All Known Subinterfaces:
  LocalName, MemberName, ScopedName, TypeName

    @UML(identifier="GenericName",
         specification=ISO_19103)
    public interface GenericName

extends Comparable<GenericName>

Base interface for scoped and local name structure for type and attribute name in the context of name spaces. All generic names:

- have the ability to provide a "parsed" version of themselves;
- carry an indication of their "depth" (e.g., the number of hierarchical levels specified by the name);
- carry an association with a specific name space, or scope, in which they are considered "local".

The same name object may not be registered in different name space. If the same character string is registered in two name spaces, two different name objects will result.

The natural ordering for generic names is implementation dependent. A recommended practice is to compare lexicographically each element in the list of parsed names. Specific attributes of the name, such as how it treats case, may affect the ordering. In general, two names of different classes may not be compared.

Since:
  GeoAPI 1.0
See Also:
  `Name`

Method Summary
`LocalName` `asLocalName()` Deprecated. Renamed as `name()`.
`ScopedName` `asScopedName()` Deprecated. Replaced by `toFullyQualifiedName()`.
`int` `depth()` Returns the depth of this name within the namespace hierarchy.
`List<LocalName>` `getParsedNames()` Returns the sequence of local names making this generic name.
`GenericName` `getScope()` Deprecated. Replaced by `scope()`.
`LocalName` `name()` Returns the last element in the sequence of parsed names.
`ScopedName` `push(GenericName name)` Returns this name expanded with the specified scope.
`NameSpace` `scope()` Returns the scope (name space) in which this name is local.
`GenericName` `toFullyQualifiedName()` Returns a view of this name as a fully-qualified name.
`InternationalString` `toInternationalString()` Returns a local-dependent string representation of this generic name.
`String` `toString()` Returns a string representation of this generic name.

Methods inherited from interface Comparable
`compareTo`

Method Detail

### scope

    @UML(identifier="scope",
         obligation=MANDATORY,
         specification=ISO_19103)
    NameSpace scope()

  Returns the scope (name space) in which this name is local. The scope is set on creation and is not modifiable. The scope of a name determines where a name "starts". For instance, if a name has a depth of two (for example `"util.GenericName"`) and is associated with a name space having the name `"org.opengis"`, then the fully qualified name would be `"org.opengis.util.GenericName"`.

  Since:
    GeoAPI 2.1

### getScope

    @UML(identifier="scope",
         obligation=OPTIONAL,
         specification=ISO_19103)
    GenericName getScope()

  Deprecated. Replaced by `scope()`.

  Returns the scope (name space) of this generic name. If this name has no scope (e.g. is the root), then this method returns `null`.

### depth

    @UML(identifier="depth",
         obligation=MANDATORY,
         specification=ISO_19103)
    int depth()

  Returns the depth of this name within the namespace hierarchy. This indicates the number of levels specified by this name. For any `LocalName`, it is always one. For a `ScopedName` it is some number greater than or equal to 2.

  The depth is the length of the list returned by the `getParsedNames()` method. As such it is a derived parameter.

  Since:
    GeoAPI 2.1

### getParsedNames

    @UML(identifier="parsedName",
         obligation=MANDATORY,
         specification=ISO_19103)
    List<LocalName> getParsedNames()

  Returns the sequence of local names making this generic name. All elements of the list except for the last one refer to name spaces. The length of this sequence is the depth.

  TODO:
    What means the "All elements of the list except for the last one refer to name spaces"? Does it means that the last element refer to the global name space?

### asLocalName

    @Extension
    LocalName asLocalName()

  Deprecated. Renamed as `name()`.

  Returns a view of this object as a local name. This is always the last element in the sequence of parsed names.

### name

    @Extension
    LocalName name()

  Returns the last element in the sequence of parsed names. For any `LocalName`, this is always `this`.

  Since:
    GeoAPI 2.1
  See Also:
    `LocalName.name()`, `ScopedName.name()`

### asScopedName

    @Extension
    ScopedName asScopedName()

  Deprecated. Replaced by `toFullyQualifiedName()`.

  Returns a view of this name as a fully-qualified name, or `null` if none. The scope of a fully qualified name must be global.

  If this name is a local name and the scope is already global, returns `null` since it is not possible to derive a scoped name.

### toFullyQualifiedName

    @Extension
    GenericName toFullyQualifiedName()

  Returns a view of this name as a fully-qualified name. The scope of a fully qualified name must be global. This method never returns `null`.

  Since:
    GeoAPI 2.1

### push

    @UML(identifier="push",
         obligation=MANDATORY,
         specification=ISO_19103)
    ScopedName push(GenericName name)

  Returns this name expanded with the specified scope. One may represent this operation as a concatenation of the specified `name` with `this`. In pseudo-code, the following relationships must hold (the last one is specific to `ScopedName`):

  - `push(name).getParsedList() == name.getParsedList().addAll(getParsedNames())`
  - `push(name).scope() == name.scope()`
  - `push(head()).tail() == this`

  Note: Those conditions can be understood in terms of the Java `equals` method instead of the Java identity comparator `==`.

  Since:
    GeoAPI 2.1

### toString

    @Extension
    String toString()

  Returns a string representation of this generic name. This string representation is local-independant. It contains all elements listed by `getParsedNames()` separated by an arbitrary character (usually `:` or `/`).

  Overrides:
    `toString` in class `Object`

### toInternationalString

    @Extension
    InternationalString toInternationalString()

  Returns a local-dependent string representation of this generic name. This string is similar to the one returned by `toString()` except that each element has been localized in the specified locale. If no international string is available, then this method should returns an implementation mapping to `toString()` for all locales.

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