gov.nasa.arc.brahms.vm.api.convert
Class ConversionContext

java.lang.Object
  extended by gov.nasa.arc.brahms.vm.api.convert.ConversionContext

public class ConversionContext
extends java.lang.Object

ConversionContext maintains additional information usable during the conversion of objects.

Version:
$Revision: 1.2 $ $Date: 2008/06/23 18:45:01 $ $Author: rvhoof $
Author:
Ron van Hoof

Constructor Summary
ConversionContext()
          Constructor, creates a new ConversionContext.
 
Method Summary
 void addBrahmsConverted(java.lang.Object jobj, IObject bobj)
          Adds the specified Java object as being or having been converted to the specified Brahms object.
 void addCreatedBrahmsObject(IObject obj)
          Adds the specified Brahms object as a Brahms object created during the conversion.
 void addJavaConverted(IObject bobj, java.lang.Object jobj)
          Adds the specified Brahms object as being or having been converted to the specified Java object.
 void clearBrahmsConverted()
          Removes all cached Java to Brahms conversions.
 void clearCreatedBrahmsObjects()
          Clears the list with created Brahms objects.
 void clearJavaConverted()
          Removes all cached Brahms to Java conversions.
 IContext getBrahmsContext()
          Returns the Brahms context used for interacting with Brahms concepts.
 IObject getBrahmsConverted(java.lang.Object jobj)
          Returns the Brahms object that was converted from the specified Java object.
 ConverterManager getConverterManager()
          Returns the ConverterManager used for the conversions.
 java.util.List<IObject> getCreatedBrahmsObjects()
          Returns the list of Brahms objects that were created during the conversion.
 IInstanceMapping getInstanceMapping()
          Returns the IInstanceMapping used to identify whether to update or create an object during conversion.
 java.lang.Object getJavaConverted(IObject bobj)
          Returns the Java object that was converted from the specified Brahms object.
 void setBrahmsContext(IContext ctx)
          Sets the Brahms context used for interacting with Brahms concepts.
 void setConverterManager(ConverterManager cm)
          Sets the ConverterManager used for the conversions.
 void setInstanceMapping(IInstanceMapping mapping)
          Sets the IInstanceMapping used to identify whether to update or create an object during conversion.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConversionContext

public ConversionContext()
Constructor, creates a new ConversionContext.

Method Detail

setConverterManager

public void setConverterManager(ConverterManager cm)
Sets the ConverterManager used for the conversions.

Parameters:
cm - the ConverterManager

getConverterManager

public ConverterManager getConverterManager()
Returns the ConverterManager used for the conversions.

Returns:
ConverterManager the converter manager

setBrahmsContext

public void setBrahmsContext(IContext ctx)
Sets the Brahms context used for interacting with Brahms concepts.

Parameters:
ctx - the Brahms IContext

getBrahmsContext

public IContext getBrahmsContext()
Returns the Brahms context used for interacting with Brahms concepts.

Returns:
IContext the Brahms context

setInstanceMapping

public void setInstanceMapping(IInstanceMapping mapping)
Sets the IInstanceMapping used to identify whether to update or create an object during conversion. If a mapping for an object being converted exists the object the converted object maps to is updated, if no mapping exists a new object is created for the conversion and added to the mapping.

Parameters:
mapping - the IInstanceMapping

getInstanceMapping

public IInstanceMapping getInstanceMapping()
Returns the IInstanceMapping used to identify whether to update or create an object during conversion. If a mapping for an object being converted exists the object the converted object maps to is updated, if no mapping exists a new object is created for the conversion and added to the mapping.

Returns:
IInstanceMapping the mapping

addBrahmsConverted

public void addBrahmsConverted(java.lang.Object jobj,
                               IObject bobj)
Adds the specified Java object as being or having been converted to the specified Brahms object.

Parameters:
jobj - the Java object being or having been converted
bobj - the Brahms object

getBrahmsConverted

public IObject getBrahmsConverted(java.lang.Object jobj)
Returns the Brahms object that was converted from the specified Java object.

Parameters:
jobj - the Java object for which to return the Brahms object
Returns:
IObject the Brahms object, null if the Java object was not yet converted

clearBrahmsConverted

public void clearBrahmsConverted()
Removes all cached Java to Brahms conversions.


addJavaConverted

public void addJavaConverted(IObject bobj,
                             java.lang.Object jobj)
Adds the specified Brahms object as being or having been converted to the specified Java object.

Parameters:
bobj - the Brahms object being or having been converted
jobj - the Java object

getJavaConverted

public java.lang.Object getJavaConverted(IObject bobj)
Returns the Java object that was converted from the specified Brahms object.

Parameters:
bobj - the Brahms object for which to return the Java object
Returns:
Object the Java object, null if the Brahms object was not yet converted

clearJavaConverted

public void clearJavaConverted()
Removes all cached Brahms to Java conversions.


addCreatedBrahmsObject

public void addCreatedBrahmsObject(IObject obj)
Adds the specified Brahms object as a Brahms object created during the conversion. To ensure proper memory management this object will need to be deleted by the actor using the converter manager when the object is no longer needed by that actor.

Parameters:
obj - the created Brahms object

getCreatedBrahmsObjects

public java.util.List<IObject> getCreatedBrahmsObjects()
Returns the list of Brahms objects that were created during the conversion. To ensure proper memory management these objects will need to be deleted by the actor using the converter manager when the objects are no longer needed by that actor.

Returns:
List the created Brahms objects

clearCreatedBrahmsObjects

public void clearCreatedBrahmsObjects()
Clears the list with created Brahms objects. This method does not delete these objects to release the object references.



Copyright © 1997-2012 All Rights Reserved.