org.jomc
Interface ObjectManager

Package class diagram package ObjectManager

@Generated(value="org.jomc.tools.JavaSources",
           comments="See http://jomc.sourceforge.net/jomc/1.0-alpha-11/jomc-tools")
public interface ObjectManager

Manages objects.

This specification declares a multiplicity of One. An application assembler is required to provide no more than one implementation of this specification (including none). Use of class ObjectManager is supported for getting that implementation.

 ObjectManager object = (ObjectManager) ObjectManagerFactory.getObjectManager( getClassLoader() ).getObject( ObjectManager.class );
 

This specification applies to Singleton scope. The same singleton object is returned whenever requested.

Version:
$Id: ObjectManager.java 1102 2009-12-07 03:01:58Z schulte2005 $
Author:
Christian Schulte 1.0

Method Summary
 Object getDependency(Object object, String dependencyName)
          Gets an instance of a dependency of an object.
 String getMessage(Object object, String messageName, Locale locale, Object arguments)
          Gets an instance of a message of an object.
 Object getObject(Class specification)
          Gets an instance of an implementation of a specification.
<T> T
getObject(Class<T> specification, String implementationName)
          Gets an instance of an implementation of a specification.
 Object getProperty(Object object, String propertyName)
          Gets an instance of a property of an object.
 

Method Detail

getObject

Object getObject(Class specification)
                 throws NullPointerException,
                        ObjectManagementException
Gets an instance of an implementation of a specification.

Note
Implementations must use the class loader associated with the given class as returned by method specification.getClassLoader() for loading classes. Only if that method returns null, indicating the class has been loaded by the bootstrap class loader, use of the bootstrap class loader is recommended.

Parameters:
specification - The specification class to return an implementation instance of.
Returns:
An instance of an implementation of the specification class specification or null if no such instance is available.
Throws:
NullPointerException - if specification is null.
ObjectManagementException - if getting the object fails.

getObject

<T> T getObject(Class<T> specification,
                String implementationName)
            throws NullPointerException,
                   ObjectManagementException
Gets an instance of an implementation of a specification.

Note
Implementations must use the class loader associated with the given class as returned by method specification.getClassLoader() for loading classes. Only if that method returns null, indicating the class has been loaded by the bootstrap class loader, use of the bootstrap class loader is recommended.

Type Parameters:
T - The type of the instance.
Parameters:
specification - The specification class to return an implementation instance of.
implementationName - The name of the implementation to return an instance of.
Returns:
An instance of the implementation named implementationName of the specification class specification or null if no such instance is available.
Throws:
NullPointerException - if specification or implementationName is null.
ObjectManagementException - if getting the object fails.

getDependency

Object getDependency(Object object,
                     String dependencyName)
                     throws NullPointerException,
                            ObjectManagementException
Gets an instance of a dependency of an object.

Note
Implementations must use the class loader associated with the class of the given object as returned by method object.getClass().getClassLoader() for loading classes. Only if that method returns null, indicating the class has been loaded by the bootstrap class loader, use of the bootstrap class loader is recommended.

Parameters:
object - The object to return a dependency instance of.
dependencyName - The name of the dependency of object to return an instance of.
Returns:
An instance of the dependency named dependencyName of object or null if no such instance is available.
Throws:
NullPointerException - if object or dependencyName is null.
ObjectManagementException - if getting the dependency instance fails.

getProperty

Object getProperty(Object object,
                   String propertyName)
                   throws NullPointerException,
                          ObjectManagementException
Gets an instance of a property of an object.

Note
Implementations must use the class loader associated with the class of the given object as returned by method object.getClass().getClassLoader() for loading classes. Only if that method returns null, indicating the class has been loaded by the bootstrap class loader, use of the bootstrap class loader is recommended.

Parameters:
object - The object to return a property instance of.
propertyName - The name of the property of object to return an instance of.
Returns:
An instance of the property named propertyName of object or null if no such instance is available.
Throws:
NullPointerException - if object or propertyName is null.
ObjectManagementException - if getting the property instance fails.

getMessage

String getMessage(Object object,
                  String messageName,
                  Locale locale,
                  Object arguments)
                  throws NullPointerException,
                         ObjectManagementException
Gets an instance of a message of an object.

Note
Implementations must use the class loader associated with the class of the given object as returned by method object.getClass().getClassLoader() for loading classes. Only if that method returns null, indicating the class has been loaded by the bootstrap class loader, use of the bootstrap class loader is recommended.

Parameters:
object - The object to return a message instance of.
messageName - The name of the message of object to return an instance of.
locale - The locale of the message instance to return.
arguments - Arguments to format the message instance with or null.
Returns:
An instance of the message named messageName of object formatted with arguments for locale or null if no such instance is available.
Throws:
NullPointerException - if object, messageName or locale is null.
ObjectManagementException - if getting the message instance fails.


Copyright © 2005-2009 The JOMC Project. All Rights Reserved.