org.codehaus.enunciate.modules.gwt
Class BaseGWTMapper<J,G>

java.lang.Object
  extended by org.codehaus.enunciate.modules.gwt.BaseGWTMapper<J,G>
All Implemented Interfaces:
CustomGWTMapper<J,G>, GWTMapper<J,G>

public abstract class BaseGWTMapper<J,G>
extends java.lang.Object
implements CustomGWTMapper<J,G>

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

Author:
Ryan Heaton

Constructor Summary
protected BaseGWTMapper(java.lang.Class<J> jaxbClass, java.lang.Class<G> gwtClass, java.lang.String... properties)
          Construct a base GWT 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> getGwtClass()
          The GWT class applicable to this mapper.
 java.lang.Class<J> getJaxbClass()
          The JAXB class applicable to this mapper.
 G toGWT(J jaxbObject, GWTMappingContext context)
          Map a JAXB object to an GWT object.
 J toJAXB(G gwtObject, GWTMappingContext context)
          Map an GWT 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

BaseGWTMapper

protected BaseGWTMapper(java.lang.Class<J> jaxbClass,
                        java.lang.Class<G> gwtClass,
                        java.lang.String... properties)
Construct a base GWT mapper.

Parameters:
jaxbClass - The JAXB class to map.
gwtClass - The GWT class to map.
properties - The properties of the JAXB class that will be mapped to corresponding properties of the GWT 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.

toGWT

public G toGWT(J jaxbObject,
               GWTMappingContext context)
        throws GWTMappingException
Map a JAXB object to an GWT object.

Specified by:
toGWT in interface GWTMapper<J,G>
Parameters:
jaxbObject - The JAXB object.
context - The mapping context.
Returns:
The mapped GWT object.
Throws:
GWTMappingException

toJAXB

public J toJAXB(G gwtObject,
                GWTMappingContext context)
         throws GWTMappingException
Map an GWT object to a JAXB object.

Specified by:
toJAXB in interface GWTMapper<J,G>
Parameters:
gwtObject - The GWT object to map.
context - The mapping context.
Returns:
The JAXB object.
Throws:
GWTMappingException

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 CustomGWTMapper<J,G>
Returns:
The JAXB class applicable to this mapper.

getGwtClass

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

Specified by:
getGwtClass in interface CustomGWTMapper<J,G>
Returns:
The GWT class applicable to this mapper.