public class Mappings extends 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.
XmlObjectFactory
Constructor and Description |
---|
Mappings() |
Modifier and Type | Method and Description |
---|---|
static void |
addLogicalMappings(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(String from)
Returns true if the mapping contains the
from value |
boolean |
containsTo(String to)
Returns true if the mapping contains the
to value |
(package private) String |
getCompletePath(String relativePath)
Constructs the complete path from the given
relativePath
and the resource of the parent getResource() as the root
of the path. |
static Mappings |
getInstance(String mappingsUri)
Returns a new configured instance of this Mappings configured from the
mappings configuration URI string.
|
static Mappings |
getInstance(URL mappingsUri)
Returns a new configured instance of this Mappings configured from the
mappings configuration URI.
|
Mapping |
getMapping(String from)
Gets the mapping having the given
from . |
Collection<Mapping> |
getMappings()
Gets all Mapping instances for for this Mappings instance.
|
String |
getName()
Returns the name name (this is the name for which the type mappings are
for).
|
URL |
getResource()
Returns the resource URI from which this Mappings object was loaded.
|
String |
getTo(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(String extendsUri)
Sets the name of the mappings which this
instance extends.
|
void |
setName(String name)
Sets the name name.
|
String |
toString() |
public Mappings()
public static Mappings getInstance(String mappingsUri)
mappingsUri
- the URI to the XML type mappings configuration file.public static Mappings getInstance(URL mappingsUri)
mappingsUri
- the URI to the XML type mappings configuration file.public static void initializeLogicalMappings()
addLogicalMappings(java.net.URL)
otherwise inheritance between logical mappings will not work correctly.public static void clearLogicalMappings()
public String getName()
public void setExtendsUri(String extendsUri)
extendsUri
- the URI of the mapping which
this one extends.public void addMapping(Mapping mapping)
mapping
- the Mapping instance.public void addMappings(Mappings mappings)
mappings
instance to this Mappings instance
overriding any mappings with duplicate names.mappings
- the Mappings instance to add this instance.public String getTo(String from)
to
mapping from a given from
mapping.from
- the from
mapping, this is the type/identifier
that is in the model.to
mapping (this is the mapping that
can be retrieved if a corresponding 'from' is found).public static void addLogicalMappings(URL mappingsUri)
mappingsUri
- the Mappings URI to add to the globally available Mapping
instances.public boolean containsFrom(String from)
from
valuefrom
- the value of the from mapping.from
, false otherwise.public boolean containsTo(String to)
to
valueto
- the value of the to mapping.to
, false otherwise.public URL getResource()
public Collection<Mapping> getMappings()
public Mapping getMapping(String from)
from
.from
- the from
mapping.final String getCompletePath(String relativePath)
relativePath
and the resource of the parent getResource()
as the root
of the path.relativePath
- public String toString()
toString
in class Object
Object.toString()
Copyright © 2003–2014 AndroMDA.org. All rights reserved.