Poseidon for UMLTM
  UMLdoc
 PREV  CLASSIFIER    NEXT  CLASSIFIER     FRAMES    NO FRAMES      
SUMMARY:   INNER | ATTR | ASSOC | CONSTR | METHOD     DETAIL:   INNER | ATTR | ASSOC | CONSTR | METHOD     DIAGRAMS:   COLLAB | SEQ | STATE | ACTIV

com.gentleware.services.util

Class ClassMap

com.gentleware.services.util.ClassMap

public class ClassMap


Maps a source class or interface to a corresponding target object. Further key objects can be added, so that a source class can be mapped onto different targets, depending on the key. A class or interface that does not have a direct mapping itself uses the mapping of its nearest super class or interface.


 Attribute Summary
private Map  _keyMapBySourceClass
A map used to store sub maps containing the mapping from key object to target classes. 
private Map  _resultBySourceClass
A map used as a cache to avoid iterating over superclasses and interfaces on each query. 
private Map  _targetClassBySourceClass
The map as maintained by put() and remove()  
arrow_up
 

 Association Summary
public InstanceCache  instanceCache
 
arrow_up
 

 Constructor Summary
public   ClassMap()
Create a new class map  
arrow_up
 

 Method Summary
private Object   findInClassHierarchy(Class sourceClass, Map elementBySourceClass)
Looks for a element in a given map with a given class object key. 
public Object   get(Class sourceClass)
 
public Object   get(Class sourceClass, Object key)
Finds the target object for this source class and the key, using super classes or interfaces if necessary. 
public void   put(Class sourceClass, Object targetObject)
 
public void   put(Class sourceClass, Object key, Object targetObject)
Insert a new mapping. 
public void   remove(Class sourceClass)
 
public void   remove(Class sourceClass, Object key)
Removes the mapping for this source class and key. 
arrow_up
 

Tagged Values
static false
gentleware-imported-line-number 16
gentleware-imported-package-statement-line-number 5
 

 Attribute Detail

_keyMapBySourceClass

private Map _keyMapBySourceClass

A map used to store sub maps containing the mapping from key object to target classes.  
arrow_up


_resultBySourceClass

private Map _resultBySourceClass

A map used as a cache to avoid iterating over superclasses and interfaces on each query.  
arrow_up


_targetClassBySourceClass

private Map _targetClassBySourceClass

The map as maintained by put() and remove()  
arrow_up
 Association Detail

instanceCache

public InstanceCache instanceCache

arrow_up
 Constructor Detail

ClassMap

public com.gentleware.services.util.ClassMap ClassMap()


Create a new class map  
Returns:
arrow_up
 Method Detail

findInClassHierarchy

private Object findInClassHierarchy(Class sourceClass, Map elementBySourceClass)


Looks for a element in a given map with a given class object key.

If the key doesn't exist, then recursively for all interfaces the class implements

as well as for all superclasses the lookup is done.  

Parameters:
sourceClass -
elementBySourceClass -
Returns:
arrow_up


get

public Object get(Class sourceClass)

Parameters:
sourceClass -
Returns:
arrow_up


get

public Object get(Class sourceClass, Object key)


Finds the target object for this source class and the key, using super classes or interfaces if necessary.  
Parameters:
sourceClass -
key -
Returns:
target or null if no mapping exists for this source class or any superclass/interface
arrow_up


put

public void put(Class sourceClass, Object targetObject)

Parameters:
sourceClass -
targetObject -
arrow_up


put

public void put(Class sourceClass, Object key, Object targetObject)


Insert a new mapping. The source can also be an interfaces. The source class/interface and all subclasses/interfaces (unless explicitly mapped themselve) will map to the given target object. If a key object is given, a further map is created which maps keys to target objects. This further map is associated to the source class. This enables mappings from one source class to multiple target objects, depending on the given key. Neither source nor target class may be null.  
Parameters:
sourceClass - this class/interface and its subclasses/interfaces will map to the target
key - The key that will map to the target
targetObject - future invocations of get with the given sourceClass will return this target
arrow_up


remove

public void remove(Class sourceClass)

Parameters:
sourceClass -
arrow_up


remove

public void remove(Class sourceClass, Object key)


Removes the mapping for this source class and key.  
Parameters:
sourceClass - the key to be removed. Must not be null.
key - The key that maps to target class.
arrow_up
Created  2004 - 12 - 1

    Poseidon for UMLTM
  UMLdoc
 PREV  CLASSIFIER    NEXT  CLASSIFIER     FRAMES    NO FRAMES      
SUMMARY:   INNER | ATTR | ASSOC | CONSTR | METHOD     DETAIL:   INNER | ATTR | ASSOC | CONSTR | METHOD     DIAGRAMS:   COLLAB | SEQ | STATE | ACTIV

Generated with Poseidon for UMLTM.
Poseidon is a registered trademark of Gentleware AG in Germany, USA and other countries. Copyright 2003-2004 Gentleware AG, Schanzenstr. 70, 20357 Hamburg, Germany. All Rights Reserved.

UML is a trademark or registered trademark of Object Management Group, Inc. in the U.S. and other countries.