|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The interface to be supported by all classes implementing resolvable addresses in TM4J. A locator may be absolute or relative, and it may be resolved relative to another locator.Each locator consists of the following components:
getNotation()
method.getAddress()
method.Locator
are usually not instantiated
directly — you should resort to using LocatorFactory.createLocator(java.lang.String, java.lang.String)
instead.
Classes implementing Locator
should ensure that they provide a
constructor of the signature (LocatorFactory, String, String)
to allow for proper locator creation on the factory's part. LocatorBase
provides such a constructor, so it's generally a good idea to extend that
class rather than implement Locator
directly.
LocatorBase.LocatorBase(LocatorFactory, String, String)
Method Summary | |
Locator |
copy()
Returns a copy of this object. |
boolean |
equals(Locator loc)
Determines the equality of this Locator to loc : |
java.lang.String |
getAddress()
Gets the address associated with the locator |
LocatorFactory |
getFactory()
Returns the locator factory associated with this locator. |
java.lang.String |
getNotation()
Gets the string defining the notation type of this locator |
int |
hashCode()
Returns the Locator's object hashcode. |
void |
initialise(java.lang.String notation,
java.lang.String address)
Initializes the locator with the specified notation and address. |
Locator |
resolveRelative(Locator rel)
Returns a new Locator whose address is the result of resolving the specified Locator relative to this Locator. |
Locator |
resolveRelative(java.lang.String rel)
Returns a new Locator whose address is the result of resolvng the specified relative address string relative to this Locator. |
void |
setFactory(LocatorFactory factory)
Associates the locator with the given factory. |
Method Detail |
public void initialise(java.lang.String notation, java.lang.String address) throws MalformedLocatorException, InvalidNotationException
notation
- the notation to be used for this locator.address
- the address to be defined by this locator.
MalformedLocatorException
- if the implementation failed to
parse the given address.
InvalidNotationException
- if the implementation does not
support the specified notation type.public LocatorFactory getFactory()
public void setFactory(LocatorFactory factory)
LocatorFactory
.
factory
- the factory to be associated with the locator.public java.lang.String getAddress()
public java.lang.String getNotation()
public Locator resolveRelative(Locator rel) throws LocatorResolutionException
rel
- The Locator to be resolved relative to this locator.
LocatorResolutionException
- if the locator could not be resolved.public Locator resolveRelative(java.lang.String rel) throws LocatorResolutionException
rel
- The address string to be resolve relative to this locator.
LocatorResolutionException
- if the locator could not be resolved.public boolean equals(Locator loc)
loc
:
true
if the inplementation determines
the two locators to be equal, false
otherwise.public int hashCode()
public Locator copy() throws LocatorFactoryException
LocatorFactoryException
- if the associated locator
factory failed to create the copy.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |