org.ocltf.mapping
Class Mappings

java.lang.Object
  extended byorg.ocltf.mapping.Mappings

public class Mappings
extends java.lang.Object

An object responsible for mapping types in the object model to other language identifiers/types. (For example, Java, SQL, Jdbc, etc). 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.


Constructor Summary
Mappings()
           
 
Method Summary
 void addMapping(Mapping mapping)
          Adds a JdbcTypeMapping object to the set of current mappings.
static Mappings getInstance(java.lang.String mappingsUri)
          Returns a new configured instance of this TypeMappings configured from the mappings configuration URI string.
static Mappings getInstance(java.net.URL mappingsUri)
          Returns a new configured instance of this TypeMappings configured from the mappings configuration URI.
 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 JDBC type for the given model type.
 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)
                            throws java.net.MalformedURLException
Returns a new configured instance of this TypeMappings configured from the mappings configuration URI string.

Parameters:
mappingsUri - the URI to the XML type mappings configuration file.
Returns:
Mappings the configured Mappings instance.
Throws:
java.net.MalformedURLException - when the mappingsUri is invalid (not a valid URL).

getInstance

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

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

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 -

addMapping

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

Parameters:
mapping - the JdbcTypeMapping instance.

getTo

public java.lang.String getTo(java.lang.String from)
Returns the JDBC type for the given model type.

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.

getResource

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

Returns:
URL

toString

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


Copyright © 2003-2004 Chad Brandon. All Rights Reserved.