ARoad0.gBaseInterface
Interface Name

All Superinterfaces:
java.lang.Cloneable, java.lang.Comparable, ImmutableName
All Known Implementing Classes:
NameImpl

public interface Name
extends ImmutableName

This interface is responsible for managing the names for all the base objects.

Examples of name are "http://tpaconseil.com", "c:\program files\access road", "net/users/john". The separator character depends on the ACS.

Name follows the OMG CORBA Object Services Specification (OMG-COSS) for a naming service which names an object for later retrieval. Methods added to the OMG specification are extended(ImmutableName), extended(String), clone(), equals(), hashCode(), getSerialVersion(), getNameFromString(). It does NOT follow the JNDI name interface.

The name is an ordered list of components in a java.util.ArrayList. Each component is a string that may be null. Case must be respected. ':: ' is a forbidden component, because it is used in toString() and getNameFromString(). It is controlled in every creating or updating method.

The usual struture of an entity name is (IS name).(ACS name).(entity name) Normally, the usual name of an instance of Name is equals to name.lastComponent().

This interface extends ImmutableName that contains all the get methods and the equivalent ones (clone(), equals()...).

To remove any component, use without(). To add a component at the end, use extended(). To modify the last component, use without() then extended(). For more complex modifying operations, use the list returned by components(). With threads, always call these methods in a block synchronized on the Name instance.

If the name is used as a key in a map, it is much safer to avoid a mutable name. Use then the ImmutableName interface to construct the key. But the update will remain possible by casting the ImmutableName in Name.


Method Summary
 Name extended(ImmutableName _name)
          For extending the current name.
 Name extended(java.lang.String _nc)
          For extending the current name.
 Name subname(int _start, int _end)
          Returns a new independant Name instance as an extract of the current Name.
 Name without(Name _name)
           
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableName
clone, compareTo, component, components, contains, context, context, equals, getSerialVersionUID, hashCode, immutableComponents, isEmpty, lastComponent, noOfComponents
 

Method Detail

without

Name without(Name _name)
Parameters:
_name - is removed from the current name. _name may be at the start, the end or the middle of the current name. If there are several sections of the current name that are strictly identical to _name, without() removes the last matched part, at the end of the current name.
Returns:
the updated name of the current name. With threads, this non-synchronized method (for performance) must be used in a synchronized block. May be null.

extended

Name extended(java.lang.String _nc)
For extending the current name. Noop if the argument is null or empty, or if ':: ' is in the argument, because it is used in toString() and getNameFromString(). With threads, this method must be used in a synchronized block.

Parameters:
_nc - adds a new last component to the current instance. The string added is not backed by the argument, so modify the new component doesn't modify the initial string used as argument in this method. With threads, this method must be used in a synchronized block
Returns:
this instance

extended

Name extended(ImmutableName _name)
For extending the current name. The name is unchanged if _name is null or an empty instance, or has a component which contains ":: " (see getNameFromString()).

Parameters:
_name - adds a new name at the end of the current instance, with string components.
Returns:
this instance
Since:
0.5.1

subname

Name subname(int _start,
             int _end)
Returns a new independant Name instance as an extract of the current Name.

Specified by:
subname in interface ImmutableName
Parameters:
_start - inclusive fromIndex
_end - exclusive toIndex
Returns:
an extract of the current name. May be null.