org.gvsig.tools.locator
Interface Locator

All Known Implementing Classes:
AbstractLocator, BaseLocator, ToolsLocator

public interface Locator

Manages references to the objects of a Library or module.

Author:
Cèsar Ordiñana

Method Summary
 Object get(String name)
          Returns a reference to the object with the given name.
 String getLocatorName()
          Returns the name of the Locator, for registration, logging, and other uses.
 String[] getNames()
          Returns the list of names of references available through this Locator.
 void register(String name, Class clazz)
          Registers a class related to a name.
 void register(String name, LocatorObjectFactory factory)
          Registers an object factory related to a name.
 void register(String name, String description, Class clazz)
          Registers a class related to a name.
 void register(String name, String description, LocatorObjectFactory factory)
          Registers an object factory related to a name.
 void registerDefault(String name, Class clazz)
           
 void registerDefault(String name, String description, Class clazz)
           
 

Method Detail

get

Object get(String name)
           throws LocatorException
Returns a reference to the object with the given name.

Parameters:
name - of the object to return
Returns:
an instance of an object, or null if not found
Throws:
LocatorException - if there is no access to the class or the class cannot be instantiated

getNames

String[] getNames()
Returns the list of names of references available through this Locator. Must return null if there are not any registered names.

Returns:
the list of names of references

register

void register(String name,
              Class clazz)
Registers a class related to a name. The class is used to create an instance of the object to return in the get(String) method.

Parameters:
name - of the object to register
clazz - the Class of the object to register

registerDefault

void registerDefault(String name,
                     Class clazz)

register

void register(String name,
              String description,
              Class clazz)
Registers a class related to a name. The class is used to create an instance of the object to return in the get(String) method.

Parameters:
name - of the object to register
description - of the object to register
clazz - the Class of the object to register

registerDefault

void registerDefault(String name,
                     String description,
                     Class clazz)

register

void register(String name,
              LocatorObjectFactory factory)
Registers an object factory related to a name. The factory is used to create an instance of the object to return in the get(String) method.

Parameters:
name - of the object to register
factory - the factory of objects to register

register

void register(String name,
              String description,
              LocatorObjectFactory factory)
Registers an object factory related to a name. The factory is used to create an instance of the object to return in the get(String) method.

Parameters:
name - of the object to register
description - of the object to register
factory - the factory of objects to register

getLocatorName

String getLocatorName()
Returns the name of the Locator, for registration, logging, and other uses.

Returns:
the name of the Locator


Copyright © 2004-2011 gvSIG. All Rights Reserved.