com.smartbear.swagger4j.impl
Class SwaggerGenerator

java.lang.Object
  extended by com.smartbear.swagger4j.impl.SwaggerGenerator
Direct Known Subclasses:
SwaggerGenerator.SwaggerJsonGenerator, SwaggerGenerator.SwaggerXmlGenerator

public abstract class SwaggerGenerator
extends Object

Utility class for abstraction of writing an actual format, since json and xml are read in the same way


Nested Class Summary
static class SwaggerGenerator.SwaggerJsonGenerator
          SwaggerGenerator implementation that reads JSON
static class SwaggerGenerator.SwaggerXmlGenerator
          SwaggerGenerator implementation that reads XML
 
Constructor Summary
SwaggerGenerator()
           
 
Method Summary
abstract  SwaggerGenerator addArray(String name, String[] values)
           
abstract  SwaggerGenerator addBoolean(String name, boolean value)
           
abstract  SwaggerGenerator addInt(String name, int value)
           
abstract  SwaggerGenerator addObject(String name)
           
abstract  SwaggerGenerator addString(String name, String value)
           
abstract  void finish()
           
static SwaggerGenerator newGenerator(Writer writer, Constants.Format format)
          Builds a SwaggerGenerator for one of the supported formats
static SwaggerGenerator newJsonGenerator(Writer writer)
          Builder for a SwaggerGenerator that can write JSON
static SwaggerGenerator newXmlGenerator(Writer writer)
          Builder for a SwaggerGenerator that can write XML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwaggerGenerator

public SwaggerGenerator()
Method Detail

addString

public abstract SwaggerGenerator addString(String name,
                                           String value)

finish

public abstract void finish()
                     throws IOException
Throws:
IOException

addObject

public abstract SwaggerGenerator addObject(String name)

addBoolean

public abstract SwaggerGenerator addBoolean(String name,
                                            boolean value)

addInt

public abstract SwaggerGenerator addInt(String name,
                                        int value)

addArray

public abstract SwaggerGenerator addArray(String name,
                                          String[] values)

newXmlGenerator

public static SwaggerGenerator newXmlGenerator(Writer writer)
                                        throws IOException
Builder for a SwaggerGenerator that can write XML

Throws:
IOException

newJsonGenerator

public static SwaggerGenerator newJsonGenerator(Writer writer)
Builder for a SwaggerGenerator that can write JSON


newGenerator

public static SwaggerGenerator newGenerator(Writer writer,
                                            Constants.Format format)
                                     throws IOException
Builds a SwaggerGenerator for one of the supported formats

Parameters:
writer - the writer to write to
format - the format
Returns:
the SwaggerGenerator
Throws:
IOException


Copyright © 2013. All Rights Reserved.