Package org.codehaus.staxmate.out

Examples of org.codehaus.staxmate.out.SMOutputElement


      }

      String nameSpaceUri = getNameSpace();
      SMNamespace nameSpace = doc.getNamespace( nameSpaceUri );

      SMOutputElement root = doc.addElement( nameSpace, getDefaultElementName() );
      serialize( root, object, getFormatVersion() );
      doc.closeRoot();
    } catch ( XMLStreamException e ) {
      throw new IOException( e );
    }
View Full Code Here


   * @param <T>           the type
   * @throws XMLStreamException if there is an xml problem
   * @throws IOException if there is an io problem
   */
  public <T> void serialize( @Nonnull T object, @Nonnull Class<T> type, @Nonnull String subElementName, @Nonnull SMOutputElement serializeTo, @Nonnull Version formatVersion ) throws XMLStreamException, IOException {
    SMOutputElement element = serializeTo.addElement( serializeTo.getNamespace(), subElementName );
    serialize( object, type, element, formatVersion );
  }
View Full Code Here

  protected <T> void serializeCollection( @Nonnull Iterable<? extends T> objects, @Nonnull Class<T> type, @Nonnull String elementName, @Nonnull SMOutputElement serializeTo, @Nonnull Version formatVersion ) throws XMLStreamException, IOException {
    AbstractXmlSerializer<? super T, SMOutputElement, XMLStreamReader, XMLStreamException> serializer = getSerializer( type );
    Version resolvedVersion = getDelegatesMappings().resolveVersion( type, formatVersion );

    for ( T object : objects ) {
      SMOutputElement doorElement = serializeTo.addElement( serializeTo.getNamespace(), elementName );
      serializer.serialize( doorElement, object, resolvedVersion );
    }
  }
View Full Code Here

  protected <T> void serializeCollection( @Nonnull Iterable<? extends T> objects, @Nonnull Class<T> type, @Nonnull SMOutputElement serializeTo, @Nonnull Version formatVersion ) throws XMLStreamException, IOException {
    AbstractXmlSerializer<? super T, SMOutputElement, XMLStreamReader, XMLStreamException> serializer = getSerializer( type );
    Version resolvedVersion = getDelegatesMappings().resolveVersion( type, formatVersion );

    for ( T object : objects ) {
      SMOutputElement doorElement = serializeTo.addElement( serializeTo.getNamespace(), serializer.getDefaultElementName() );
      serializer.serialize( doorElement, object, resolvedVersion );
    }
  }
View Full Code Here

   * @param formatVersion         the format version
   * @throws XMLStreamException if there is an xml problem
   * @throws IOException if there is an io problem
   */
  protected <T> void serializeCollectionToElement( @Nonnull Iterable<? extends T> objects, @Nonnull Class<T> type, @Nonnull String collectionElementName, @Nonnull String elementName, @Nonnull SMOutputElement serializeTo, Version formatVersion ) throws XMLStreamException, IOException {
    SMOutputElement collectionElement = serializeTo.addElement( serializeTo.getNamespace(), collectionElementName );
    serializeCollection( objects, type, elementName, collectionElement, formatVersion );
  }
View Full Code Here

    SMOutputElement collectionElement = serializeTo.addElement( serializeTo.getNamespace(), collectionElementName );
    serializeCollection( objects, type, elementName, collectionElement, formatVersion );
  }

  protected <T> void serializeCollectionToElement( @Nonnull Iterable<? extends T> objects, @Nonnull Class<T> type, @Nonnull String collectionElementName, @Nonnull SMOutputElement serializeTo, Version formatVersion ) throws XMLStreamException, IOException {
    SMOutputElement collectionElement = serializeTo.addElement( serializeTo.getNamespace(), collectionElementName );
    serializeCollection( objects, type, collectionElement, formatVersion );
  }
View Full Code Here

    assert isVersionWritable( formatVersion );
    serializeTo.addAttribute( ATTRIBUTE_DEPENDENT, String.valueOf( object.isDependentType() ) );
    serializeTo.addElement( serializeTo.getNamespace(), ELEMENT_ID ).addCharacters( object.getId() );

    for ( Extension extension : object.getExtensions() ) {
      SMOutputElement extensionElement = serializeTo.addElement( serializeTo.getNamespace(), ELEMENT_EXTENSION );

      if ( object.isDefaultExtension( extension ) ) {
        extensionElement.addAttribute( ATTRIBUTE_DEFAULT, String.valueOf( true ) );
      }

      serialize( extension, Extension.class, extensionElement, formatVersion );
    }
  }
View Full Code Here

  @Override
  public void serialize( @NotNull SMOutputElement serializeTo, @NotNull Application object ) throws IOException, XMLStreamException {
    serializeTo.addElement( ELEMENT_NAME ).addCharacters( object.getName() );

    SMOutputElement versionElement = serializeTo.addElement( ELEMENT_VERSION );
    versionSerializer.serialize( versionElement, object.getVersion() );


  }
View Full Code Here

  public void serialize( @NotNull T object, @NotNull OutputStream out, @Nullable C context ) throws IOException {
    try {
      SMOutputDocument doc = StaxMateSupport.getSmOutputFactory().createOutputDocument( out );
      serializeFormatVersion( doc, getFormatVersion() );

      SMOutputElement root = doc.addElement( getDefaultElementName() );
      serialize( root, object, context );
      doc.closeRoot();
    } catch ( XMLStreamException e ) {
      throw new IOException( e );
    }
View Full Code Here

  @Override
  public void serialize( @NotNull T object, @NotNull OutputStream out, @Nullable Lookup context ) throws IOException {
    try {
      SMOutputDocument doc = StaxSupport.getSmOutputFactory().createOutputDocument( out );
      //    doc.setIndentation( "\n  ", 1, 2 );
      SMOutputElement root = doc.addElement( getDefaultElementName() );
      serialize( root, object, context != null ? context : Lookups.emtyLookup() );
      doc.closeRoot();
    } catch ( XMLStreamException e ) {
      throw new IOException( e );
    }
View Full Code Here

TOP

Related Classes of org.codehaus.staxmate.out.SMOutputElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.