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

java.lang.Object
  extended by gov.nasa.arc.brahms.vm.api.convert.BeanConverter
All Implemented Interfaces:
IConverter

public class BeanConverter
extends java.lang.Object
implements IConverter

BeanConverter handles the conversion between Java and Brahms objects with the Java objects complying with the Java Bean specification for automatic discovery of members and their read/write methods. It assumes that a Brahms class with the same qualified name as the Java class exists and that the Brahms attribute and relation names are the same as the bean property names of the Java class.

Version:
$Revision: 1.8 $ $Date: 2008/10/21 22:08:31 $ $Author: rvhoof $
Author:
Ron van Hoof

Field Summary
static java.lang.String TYPE
          The converter's type name
 
Constructor Summary
BeanConverter()
           
 
Method Summary
 java.lang.Object toBrahms(java.lang.Class<?> javaType, java.lang.Object javaValue, IType brahmsType, ConversionContext ctx)
          Converts the specified Java value into its matching Brahms value.
 java.lang.Object toJava(IType brahmsType, java.lang.Object brahmsValue, java.lang.Class<?> javaType, ConversionContext ctx)
          Converts the specified Brahms value into its matching Java value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE

public static final java.lang.String TYPE
The converter's type name

See Also:
Constant Field Values
Constructor Detail

BeanConverter

public BeanConverter()
Method Detail

toJava

public java.lang.Object toJava(IType brahmsType,
                               java.lang.Object brahmsValue,
                               java.lang.Class<?> javaType,
                               ConversionContext ctx)
                        throws ExternalException
Converts the specified Brahms value into its matching Java value.

Specified by:
toJava in interface IConverter
Parameters:
brahmsType - the Brahms type of the value
brahmsValue - the Brahms value to convert
javaType - the Java type to convert the value to
ctx - the ConversionContext
Returns:
Object the converted Java value
Throws:
ExternalException - if there was a problem converting the value

toBrahms

public java.lang.Object toBrahms(java.lang.Class<?> javaType,
                                 java.lang.Object javaValue,
                                 IType brahmsType,
                                 ConversionContext ctx)
                          throws ExternalException
Converts the specified Java value into its matching Brahms value.

Specified by:
toBrahms in interface IConverter
Parameters:
javaType - the java type of the value
javaValue - the java value to convert
brahmsType - the Brahms type to convert the value to
ctx - the ConversionContext
Returns:
Object the converted Brahms value
Throws:
ExternalException - if there was a problem converting the value


Copyright © 1997-2012 All Rights Reserved.