org.codehaus.enunciate.modules.amf
Class BaseAMFMapper<J,G>

java.lang.Object
  extended by org.codehaus.enunciate.modules.amf.BaseAMFMapper<J,G>
All Implemented Interfaces:
AMFMapper<J,G>, CustomAMFMapper<J,G>

public abstract class BaseAMFMapper<J,G>
extends java.lang.Object
implements CustomAMFMapper<J,G>

Base implementation of an AMFMapper. If a custom mapper exists for a certain JAXB class, it is assumed to exist in the "amf" package relative to the JAXB class package, same name, with "AMFMapper" appended to the class name. Since it's generated, it will likely extend this base mapper class.

Author:
Ryan Heaton

Constructor Summary
protected BaseAMFMapper(java.lang.Class<J> jaxbClass, java.lang.Class<G> amfClass, java.lang.String... properties)
          Construct a base AMF mapper.
 
Method Summary
static java.lang.String[] append(java.lang.String[] args1, java.lang.String... args2)
          Utility for appending one string array to another.
protected  java.beans.PropertyDescriptor findProperty(java.lang.Class clazz, java.lang.String property)
          Find the specified property for the given class.
 java.lang.Class<G> getAmfClass()
          The AMF class applicable to this mapper.
 java.lang.Class<J> getJaxbClass()
          The JAXB class applicable to this mapper.
 G toAMF(J jaxbObject, AMFMappingContext context)
          Map a JAXB object to an AMF object.
 J toJAXB(G amfObject, AMFMappingContext context)
          Map an AMF object to a JAXB object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseAMFMapper

protected BaseAMFMapper(java.lang.Class<J> jaxbClass,
                        java.lang.Class<G> amfClass,
                        java.lang.String... properties)
Construct a base AMF mapper.

Parameters:
jaxbClass - The JAXB class to map.
amfClass - The AMF class to map.
properties - The properties of the JAXB class that will be mapped to corresponding properties of the AMF class.
Method Detail

findProperty

protected java.beans.PropertyDescriptor findProperty(java.lang.Class clazz,
                                                     java.lang.String property)
Find the specified property for the given class.

Parameters:
clazz - The class.
property - The property.
Returns:
The property descriptor.

toAMF

public G toAMF(J jaxbObject,
               AMFMappingContext context)
        throws AMFMappingException
Map a JAXB object to an AMF object.

Specified by:
toAMF in interface AMFMapper<J,G>
Parameters:
jaxbObject - The JAXB object.
context - The mapping context.
Returns:
The mapped AMF object.
Throws:
AMFMappingException

toJAXB

public J toJAXB(G amfObject,
                AMFMappingContext context)
         throws AMFMappingException
Map an AMF object to a JAXB object.

Specified by:
toJAXB in interface AMFMapper<J,G>
Parameters:
amfObject - The AMF object to map.
context - The mapping context.
Returns:
The JAXB object.
Throws:
AMFMappingException

append

public static java.lang.String[] append(java.lang.String[] args1,
                                        java.lang.String... args2)
Utility for appending one string array to another.

Parameters:
args1 - The first set of args.
args2 - The second set of args.
Returns:
The appended array.

getJaxbClass

public java.lang.Class<J> getJaxbClass()
The JAXB class applicable to this mapper.

Specified by:
getJaxbClass in interface CustomAMFMapper<J,G>
Returns:
The JAXB class applicable to this mapper.

getAmfClass

public java.lang.Class<G> getAmfClass()
The AMF class applicable to this mapper.

Specified by:
getAmfClass in interface CustomAMFMapper<J,G>
Returns:
The AMF class applicable to this mapper.