Class DefaultLocalName

Object
AbstractName
DefaultLocalName
All Implemented Interfaces:
Serializable, Comparable<Generic­Name>, Generic­Name, Local­Name
Direct Known Subclasses:
Default­Member­Name, Default­Type­Name

public class DefaultLocalName extends AbstractName implements LocalName
Identifier within a name space for a local object. Local names are names which are directly accessible to and maintained by a name space. Names are local to one and only one name space. The name space within which they are local is indicated by the scope.

Default­Local­Name can be instantiated by any of the following methods:

Immutability and thread safety

This class is immutable and thus inherently thread-safe if the Name­Space and Char­Sequence arguments given to the constructor are also immutable. Subclasses shall make sure that any overridden methods remain safe to call from multiple threads and do not change any public Local­Name state.
Since:
0.3
See Also:

Defined in the sis-metadata module

  • Constructor Details

  • Method Details

    • castOrCopy

      public static DefaultLocalName castOrCopy(LocalName object)
      Returns a SIS local name implementation with the values of the given arbitrary implementation. This method performs the first applicable action in the following choices:
      • If the given object is null, then this method returns null.
      • Otherwise if the given object is an instance of Member­Name or Type­Name, then this method delegates to cast­Or­Copy(…) method of the corresponding subclass.
      • Otherwise if the given object is already an instance of Default­Local­Name, then it is returned unchanged.
      • Otherwise a new Default­Local­Name instance is created with the same values than the given name.
      Parameters:
      object - the object to get as a SIS implementation, or null if none.
      Returns:
      a SIS implementation containing the values of the given object (may be the given object itself), or null if the argument was null.
    • scope

      public NameSpace scope()
      Returns the scope (name space) in which this name is local. This method returns a non-null value in all cases, even when the scope given to the constructor was null.
      Specified by:
      scope in interface Generic­Name
      Specified by:
      scope in class Abstract­Name
      Returns:
      the scope of this name.
    • depth

      public final int depth()
      Returns the depth, which is always 1 for a local name.
      Specified by:
      depth in interface Generic­Name
      Specified by:
      depth in interface Local­Name
      Overrides:
      depth in class Abstract­Name
      Returns:
      the depth of this name.
    • getParsedNames

      public final List<DefaultLocalName> getParsedNames()
      Returns the sequence of local name for this name. Since this object is itself a local name, this method always returns a singleton containing only this.
      Specified by:
      get­Parsed­Names in interface Generic­Name
      Specified by:
      get­Parsed­Names in interface Local­Name
      Specified by:
      get­Parsed­Names in class Abstract­Name
      Returns:
      the local names making this generic name, without the scope. Shall never be null neither empty.
    • head

      public final LocalName head()
      Returns this since this object is already a local name.
      Specified by:
      head in interface Generic­Name
      Specified by:
      head in interface Local­Name
      Overrides:
      head in class Abstract­Name
      Returns:
      this.
    • tip

      public final LocalName tip()
      Returns this since this object is already a local name.
      Specified by:
      tip in interface Generic­Name
      Specified by:
      tip in interface Local­Name
      Overrides:
      tip in class Abstract­Name
      Returns:
      this.
    • toString

      public String toString()
      Returns a locale-independent string representation of this local name. This string does not include the scope, which is consistent with the parsed names definition.
      Specified by:
      to­String in interface Generic­Name
      Specified by:
      to­String in interface Local­Name
      Overrides:
      to­String in class Abstract­Name
      Returns:
      a local-independent string representation of this name.
    • toInternationalString

      public InternationalString toInternationalString()
      Returns a local-dependent string representation of this local name.
      Specified by:
      to­International­String in interface Generic­Name
      Overrides:
      to­International­String in class Abstract­Name
      Returns:
      a localizable string representation of this name.
    • compareTo

      public int compareTo(GenericName name)
      Compares this name with the specified object for order. Returns a negative integer, zero, or a positive integer as this name lexicographically precedes, is equal to, or follows the specified object.
      Specified by:
      compare­To in interface Comparable<Generic­Name>
      Overrides:
      compare­To in class Abstract­Name
      Parameters:
      name - the other name to compare with this name.
      Returns:
      -1 if this name precedes the given one, +1 if it follows, 0 if equals.
    • equals

      public boolean equals(Object object)
      Compares this local name with the specified object for equality.
      Overrides:
      equals in class Abstract­Name
      Parameters:
      object - the object to compare with this name for equality.
      Returns:
      true if the given object is equal to this name.