org.andromda.core.mapping
Class Mappings

java.lang.Object
  extended by org.andromda.core.mapping.Mappings

public class Mappings
extends java.lang.Object

An object responsible for mapping multiple from values to single to. The public constructor should NOT be used to construct this instance. An instance of this object should be retrieved through the method getInstance(java.net.URL).

The mappings will change based upon the language, database, etc being used.

Author:
Chad Brandon, Wouter Zoons
See Also:
XmlObjectFactory

Constructor Summary
Mappings()
           
 
Method Summary
static void addLogicalMappings(java.net.URL mappingsUri)
          Adds a mapping to the globally available mappings, these are used by this class to instantiate mappings from logical names as opposed to physical names.
 void addMapping(Mapping mapping)
          Adds a Mapping object to the set of current mappings.
 void addMappings(Mappings mappings)
          Adds the mappings instance to this Mappings instance overriding any mappings with duplicate names.
static void clearLogicalMappings()
          Clears the entries from the logical mappings cache.
 boolean containsFrom(java.lang.String from)
          Returns true if the mapping contains the from value
static Mappings getInstance(java.lang.String mappingsUri)
          Returns a new configured instance of this Mappings configured from the mappings configuration URI string.
static Mappings getInstance(java.net.URL mappingsUri)
          Returns a new configured instance of this Mappings configured from the mappings configuration URI.
 Mapping getMapping(java.lang.String from)
          Gets the mapping having the given from.
 java.util.Collection getMappings()
          Gets all Mapping instances for for this Mappings instance.
 java.lang.String getName()
          Returns the name name (this is the name for which the type mappings are for).
 java.net.URL getResource()
          Returns the resource URI from which this Mappings object was loaded.
 java.lang.String getTo(java.lang.String from)
          Returns the to mapping from a given from mapping.
static void initializeLogicalMappings()
          This initializes all logical mappings that are contained with global Mapping set.
 void setExtendsUri(java.lang.String extendsUri)
          Sets the name of the mappings which this instance extends.
 void setName(java.lang.String name)
          Sets the name name.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Mappings

public Mappings()
Method Detail

getInstance

public static Mappings getInstance(java.lang.String mappingsUri)
Returns a new configured instance of this Mappings configured from the mappings configuration URI string.

Parameters:
mappingsUri - the URI to the XML type mappings configuration file.
Returns:
Mappings the configured Mappings instance.

getInstance

public static Mappings getInstance(java.net.URL mappingsUri)
Returns a new configured instance of this Mappings configured from the mappings configuration URI.

Parameters:
mappingsUri - the URI to the XML type mappings configuration file.
Returns:
Mappings the configured Mappings instance.

initializeLogicalMappings

public static void initializeLogicalMappings()
This initializes all logical mappings that are contained with global Mapping set. This MUST be called after all logical mappings have been added through addLogicalMappings(java.net.URL) otherwise inheritance between logical mappings will not work correctly.


clearLogicalMappings

public static void clearLogicalMappings()
Clears the entries from the logical mappings cache.


getName

public java.lang.String getName()
Returns the name name (this is the name for which the type mappings are for).

Returns:
String the name name

setName

public void setName(java.lang.String name)
Sets the name name.

Parameters:
name -

setExtendsUri

public void setExtendsUri(java.lang.String extendsUri)
Sets the name of the mappings which this instance extends.

Parameters:
extendsUri - the URI of the mapping which this one extends.

addMapping

public void addMapping(Mapping mapping)
Adds a Mapping object to the set of current mappings.

Parameters:
mapping - the Mapping instance.

addMappings

public void addMappings(Mappings mappings)
Adds the mappings instance to this Mappings instance overriding any mappings with duplicate names.

Parameters:
mappings - the Mappings instance to add this instance.

getTo

public java.lang.String getTo(java.lang.String from)
Returns the to mapping from a given from mapping.

Parameters:
from - the from mapping, this is the type/identifier that is in the model.
Returns:
String to the to mapping (this is the mapping that can be retrieved if a corresponding 'from' is found).

addLogicalMappings

public static void addLogicalMappings(java.net.URL mappingsUri)
Adds a mapping to the globally available mappings, these are used by this class to instantiate mappings from logical names as opposed to physical names.

Parameters:
mappingsUri - the Mappings URI to add to the globally available Mapping instances.

containsFrom

public boolean containsFrom(java.lang.String from)
Returns true if the mapping contains the from value

Parameters:
from - the value of the from mapping.
Returns:
true if it contains from, false otherwise.

getResource

public java.net.URL getResource()
Returns the resource URI from which this Mappings object was loaded.

Returns:
URL of the resource.

getMappings

public java.util.Collection getMappings()
Gets all Mapping instances for for this Mappings instance.

Returns:
a collection containing all Mapping instances.

getMapping

public Mapping getMapping(java.lang.String from)
Gets the mapping having the given from.

Parameters:
from - the from mapping.
Returns:
the Mapping instance (or null if it doesn't exist).

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2003-2008 AndroMDA.org. All Rights Reserved.