You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dg...@apache.org on 2003/09/02 06:50:54 UTC

cvs commit: jakarta-commons-sandbox/mapper/src/share/org/apache/commons/mapper MapperFactory.java

dgraham     2003/09/01 21:50:54

  Modified:    mapper/src/share/org/apache/commons/mapper
                        MapperFactory.java
  Log:
  javadoc changes only.
  
  Revision  Changes    Path
  1.7       +39 -34    jakarta-commons-sandbox/mapper/src/share/org/apache/commons/mapper/MapperFactory.java
  
  Index: MapperFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/mapper/src/share/org/apache/commons/mapper/MapperFactory.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MapperFactory.java	10 Jul 2003 03:11:00 -0000	1.6
  +++ MapperFactory.java	2 Sep 2003 04:50:54 -0000	1.7
  @@ -70,25 +70,28 @@
   import org.apache.commons.mapper.util.ObjectFactory;
   
   /**
  - * MapperFactory is responsible for creating mappers based on domain class names 
  - * or any other String name.  This allows a domain class to be a value bean and 
  - * delegate data storage responsibility to a specific Mapper subclass.
  + * <code>MapperFactory</code> is responsible for creating mappers based on 
  + * domain class names or any other String name.  This allows a domain class to 
  + * be a value bean and delegate data storage responsibility to a specific 
  + * <code>Mapper</code> subclass.
    * <p>
  - * MapperFactory.getMapper() method uses caching to prevent creating mappers
  - * multiple times.  This means that a Mapper returned from getMapper will not be a 
  - * new instance which could cause problems in a multi-threaded environment 
  - * (the servlet container environment is multi-threaded).  Mappers returned by the 
  - * MapperFactory should not use instance variables to maintain state, rather, they 
  - * should use local method variables so they are thread-safe.
  + * <code>MapperFactory.getMapper()</code> method uses caching to prevent 
  + * creating mappers multiple times.  This means that a Mapper returned from 
  + * <code>getMapper()</code> will not be a new instance which could cause 
  + * problems in a multi-threaded environment (the servlet container environment 
  + * is multi-threaded).  Mappers returned by the <code>MapperFactory</cdoe> 
  + * should not use instance variables to maintain state, rather, they should 
  + * use local method variables so they are thread-safe.
    * <p>
  - * Note that you do not need to subclass MapperFactory to specify the specific Mapper 
  - * implementation classes to return from getMapper().  Because mapper 
  - * implementation classes are defined in a Map, you can have any combination of 
  - * Mapper types in use at the same time.  For example, you could have 
  - * EjbPersonMapper using an EJB to persist Person objects and a JdbcOrderMapper 
  - * using JDBC calls to persist Order objects.  You can register MapperFactoryListener
  - * implementations with the factory to initialize the various types of Mappers when
  - * they are created.
  + * Note that you do not need to subclass <code>MapperFactory</code> to specify 
  + * the specific <code>Mapper</code> implementation classes to return from 
  + * <code>getMapper()</code>.  Because <code>Mapper</code> implementation 
  + * classes are defined in a <code>Map</code>, you can have any combination of 
  + * <code>Mapper</code> types in use at the same time.  For example, you could 
  + * have EjbPersonMapper using an EJB to persist Person objects and a 
  + * JdbcOrderMapper using JDBC calls to persist Order objects.  You can register 
  + * <code>MapperFactoryListener</code> implementations with the factory to 
  + * initialize the various types of Mappers when they are created.
    * 
    * @see Mapper
    * @see MapperFactoryListener
  @@ -102,8 +105,9 @@
       protected ObjectFactory factory = null;
   
       /** 
  -     * Holds mapper instances that have already been created.   The key is a String 
  -     * name which is often a domain class' name and the value is a Mapper instance.
  +     * Holds mapper instances that have already been created.   The key is a 
  +     * String name which is often a domain class' name and the value is a 
  +     * <code>Mapper</code> instance.
        */
       protected Map mapperCache = new HashMap();
   
  @@ -114,10 +118,10 @@
   
       /**
        * Create a new MapperFactory with the mappings contained in the given Map.
  -     * @param map Any map containing logical names (often domain class names) as 
  -     * the keys and mapper class names as the values.
  -     * @throws IllegalArgumentException if there is a problem finding the mapped 
  -     * classes.  
  +     * @param map Any map containing logical names (often domain class names) 
  +     * as the keys and mapper class names as the values.
  +     * @throws IllegalArgumentException if there is a problem finding the 
  +     * mapped classes.  
        */
       public MapperFactory(Map map) {
           super();
  @@ -128,9 +132,9 @@
        * Factory method for getting the mapper associated with the given class.
        * @param mappedClass The class whose mapper should be returned
        * @return Mapper the mapper associated with the given class
  -     * @throws IllegalArgumentException if the given Class was not found in the map
  -     * or there was an error creating an instance of the Mapper.  This is usually caused
  -     * by a missing public no-arg constructor.
  +     * @throws IllegalArgumentException if the given Class was not found in 
  +     * the map or there was an error creating an instance of the Mapper.  This 
  +     * is usually caused by a missing public no-arg constructor.
        */
       public Mapper getMapper(Class mappedClass) {
           return this.getMapper(mappedClass.getName());
  @@ -140,9 +144,9 @@
        * Factory method for getting the mapper associated with the given class.
        * @param name The name of the mapper to be returned.
        * @return Mapper the mapper associated with the given name.
  -     * @throws IllegalArgumentException if the given name was not found in the map
  -     * or there was an error creating an instance of the Mapper.  This is usually caused
  -     * by a missing public no-arg constructor.
  +     * @throws IllegalArgumentException if the given name was not found in 
  +     * the map or there was an error creating an instance of the Mapper.  This 
  +     * is usually caused by a missing public no-arg constructor.
        */
       public Mapper getMapper(String name) {
   
  @@ -159,7 +163,8 @@
       }
   
       /**
  -     * Register a listener with this MapperFactory to receive notifications of events.
  +     * Register a listener with this MapperFactory to receive notifications 
  +     * of events.
        * @param listener
        */
       public void addMapperFactoryListener(MapperFactoryListener listener) {
  @@ -193,7 +198,7 @@
                   listener.mapperCreated(event);
               }
           }
  -        
  +
       }
   
   }