com.cedarsoft.serialization.stax
Class AbstractStaxMateSerializer<T>

java.lang.Object
  extended by com.cedarsoft.serialization.AbstractSerializer<T,org.codehaus.staxmate.out.SMOutputElement,org.codehaus.stax2.XMLStreamReader2,javax.xml.stream.XMLStreamException>
      extended by com.cedarsoft.serialization.stax.AbstractStaxMateSerializer<T>
Type Parameters:
T - the type
All Implemented Interfaces:
ExtendedSerializer<T>, PluggableSerializer<T,org.codehaus.staxmate.out.SMOutputElement,org.codehaus.stax2.XMLStreamReader2,javax.xml.stream.XMLStreamException>, Serializer<T,Lookup>
Direct Known Subclasses:
AbstractDelegatingStaxMateSerializer, AbstractStaxMateSerializingStrategy, DateTimeSerializer, DimensionSerializer

public abstract class AbstractStaxMateSerializer<T>
extends AbstractSerializer<T,org.codehaus.staxmate.out.SMOutputElement,org.codehaus.stax2.XMLStreamReader2,javax.xml.stream.XMLStreamException>


Nested Class Summary
static interface AbstractStaxMateSerializer.CB
           
 
Constructor Summary
protected AbstractStaxMateSerializer(java.lang.String defaultElementName)
           
 
Method Summary
protected  void closeTag(javax.xml.stream.XMLStreamReader reader)
           
 T deserialize(java.io.InputStream in, Lookup context)
          Deserializes the object from the input stream
protected  void ensureTag(javax.xml.stream.XMLStreamReader deserializeFrom, java.lang.String tagName)
           
protected  java.lang.String getChildText(javax.xml.stream.XMLStreamReader reader, java.lang.String tagName)
           
protected  java.lang.String getText(javax.xml.stream.XMLStreamReader reader)
          Returns the text and closes the tag
protected  void nextTag(javax.xml.stream.XMLStreamReader reader, java.lang.String tagName)
           
 void serialize(T object, java.io.OutputStream out, Lookup context)
          Serializes the object to the given output stream
protected  void visitChildren(org.codehaus.stax2.XMLStreamReader2 streamReader, AbstractStaxMateSerializer.CB callback)
          Attention! The current element will be closed!
 
Methods inherited from class com.cedarsoft.serialization.AbstractSerializer
deserialize, getDefaultElementName, serialize, serialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.cedarsoft.serialization.PluggableSerializer
deserialize, serialize
 

Constructor Detail

AbstractStaxMateSerializer

protected AbstractStaxMateSerializer(@NotNull@NonNls
                                     java.lang.String defaultElementName)
Method Detail

serialize

public void serialize(@NotNull
                      T object,
                      @NotNull
                      java.io.OutputStream out,
                      @Nullable
                      Lookup context)
               throws java.io.IOException
Description copied from interface: Serializer
Serializes the object to the given output stream

Parameters:
object - the object
out - the out stream
context - the context (optional)
Throws:
java.io.IOException

deserialize

@NotNull
public T deserialize(@NotNull
                             java.io.InputStream in,
                             @Nullable
                             Lookup context)
              throws java.io.IOException
Description copied from interface: Serializer
Deserializes the object from the input stream

Parameters:
in - the input stream
context - the context (optional)
Returns:
the deserialized object
Throws:
java.io.IOException

ensureTag

protected void ensureTag(@NotNull
                         javax.xml.stream.XMLStreamReader deserializeFrom,
                         @NotNull@NonNls
                         java.lang.String tagName)

getText

@NotNull
protected java.lang.String getText(@NotNull
                                           javax.xml.stream.XMLStreamReader reader)
                            throws javax.xml.stream.XMLStreamException
Returns the text and closes the tag

Parameters:
reader - the reader
Returns:
the text
Throws:
javax.xml.stream.XMLStreamException

getChildText

@NotNull
protected java.lang.String getChildText(@NotNull
                                                javax.xml.stream.XMLStreamReader reader,
                                                @NotNull@NonNls
                                                java.lang.String tagName)
                                 throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

closeTag

protected void closeTag(@NotNull
                        javax.xml.stream.XMLStreamReader reader)
                 throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

nextTag

protected void nextTag(@NotNull
                       javax.xml.stream.XMLStreamReader reader,
                       @NotNull@NonNls
                       java.lang.String tagName)
                throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

visitChildren

protected void visitChildren(@NotNull
                             org.codehaus.stax2.XMLStreamReader2 streamReader,
                             @NotNull
                             AbstractStaxMateSerializer.CB callback)
                      throws javax.xml.stream.XMLStreamException,
                             java.io.IOException
Attention! The current element will be closed!

Parameters:
streamReader - the stream reader
callback - the callback
Throws:
javax.xml.stream.XMLStreamException
java.io.IOException


Copyright © 2009 cedarsoft GmbH. All Rights Reserved.