it.assist.jrecordbind
Class Marshaller<E>

java.lang.Object
  extended by it.assist.jrecordbind.Marshaller<E>

public class Marshaller<E>
extends Object

Marshalls beans according to the given .xsd definition

Author:
Federico Fissore

Field Summary
protected  it.assist.jrecordbind.ConvertersCache converters
           
protected  it.assist.jrecordbind.RecordDefinition definition
           
protected  it.assist.jrecordbind.Cache<Padder> padders
           
protected  it.assist.jrecordbind.PropertyUtils propertyUtils
           
 
Constructor Summary
Marshaller(File definition)
          Creates a new marshaller, reading the configuration specified in the .xsd definition given as input.
Marshaller(InputSource definition)
          Creates a new marshaller, reading the configuration specified in the .xsd definition given as input.
Marshaller(Reader definition)
          Creates a new marshaller, reading the configuration specified in the .xsd definition given as input.
 
Method Summary
 void marshall(E record, Writer writer)
          Marshalls a bean to a writer
 void marshallAll(Collection<E> records, Writer writer)
          Marshalls a collection of beans to a writer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

converters

protected final it.assist.jrecordbind.ConvertersCache converters

definition

protected final it.assist.jrecordbind.RecordDefinition definition

padders

protected final it.assist.jrecordbind.Cache<Padder> padders

propertyUtils

protected final it.assist.jrecordbind.PropertyUtils propertyUtils
Constructor Detail

Marshaller

public Marshaller(File definition)
Creates a new marshaller, reading the configuration specified in the .xsd definition given as input. Fields without a specific padder will be left aligned with spaces.
This is the most convenient way to init the Marshaller since it will resolve local XSDs

Parameters:
definition - the .xsd definition
See Also:
SpaceRightPadder

Marshaller

public Marshaller(Reader definition)
Creates a new marshaller, reading the configuration specified in the .xsd definition given as input. Fields without a specific padder will be left aligned with spaces.
Use this constructor only if your XSD is self contained (no included/imported XSDs)

Parameters:
definition - the .xsd definition
See Also:
SpaceRightPadder

Marshaller

public Marshaller(InputSource definition)
Creates a new marshaller, reading the configuration specified in the .xsd definition given as input. Fields without a specific padder will be left aligned with spaces.
Use this constructor only if you know how to handle an InputSource

Parameters:
definition - the .xsd definition
See Also:
SpaceRightPadder
Method Detail

marshall

public void marshall(E record,
                     Writer writer)
              throws IOException
Marshalls a bean to a writer

Parameters:
record - the bean to marshal
writer - the target writer
Throws:
IOException

marshallAll

public void marshallAll(Collection<E> records,
                        Writer writer)
                 throws IOException
Marshalls a collection of beans to a writer

Parameters:
records - the beans to marshall
writer - the target writer
Throws:
IOException


Copyright © 2009-2011. All Rights Reserved.