-
Notifications
You must be signed in to change notification settings - Fork 41
API Details
Alessandro Vurro edited this page Jun 10, 2016
·
27 revisions
On this page are described in detail all the components of JMapperAPI.
in order to improve readability and simplify the implementation it is strongly recommended to import static methods provided by JMapperAPI:
...
import static com.googlecode.jmapper.api.JMapperAPI.*;
...
The starting point is JMapperAPI, you need to create it to define a configuration:
JMapperAPI api = new JMapperAPI();
An instance of api permits to do two actions: add mapped classes and print the XML as String format:
-
add(..)
method takes as input an instance of MappedClass.
-
toXStream()
method returns the bean with xstream annotations, to print the xml just call the methodtoString()
.
To define a mapped Class what you need is create an instance of MappedClass
passing the class or a the literal name of that:
MappedClass clazz = new MappedClass(aClass.class);
//or
MappedClass clazz = new MappedClass("package.aClass");
and after add it in api instance:
api.add(clazz);
for readability is recommended to use static methods provided by JMapperAPI (in this case mappedClass
method):
api.add(mappedClass(aClass.class));
//or
api.add(mappedClass("package.aClass"));
as JMapperAPI MappedClass has only two methods:
-
add(..)
method takes as input an instance of Attribute, Global or Conversion.
-
toXStream()
method returns the bean with xstream annotations, to print the xml just call the methodtoString()
.
under construction
© 2016 Alessandro Vurro
- Home
- How to map
- Relations
- Conversions
- creation/enrichment
- XML
- Annotation
- API
- Configurations
- Utilities
- Examples
- Articles
- More information
- Performance tests
- Release Notes