org.apache.bval.json
Class JSONGenerator

java.lang.Object
  extended by org.apache.bval.json.JSONGenerator

public class JSONGenerator
extends Object

Description: Generate a JSON String for a collection of MetaBeans. This implementation uses a freemarker template to generate the output.
This is an optional module which requires the freemarker dependency and template resourece file "bean-infos-json.ftl" with it.


Constructor Summary
JSONGenerator()
           
JSONGenerator(String templateName)
           
JSONGenerator(freemarker.template.Template template)
           
 
Method Summary
 String toJSON(Collection<MetaBean> metaBeans)
           
 void toJSON(Collection<MetaBean> metaBeans, Writer out)
           
 String toJSON(MetaBean metaBean)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONGenerator

public JSONGenerator()
              throws IOException
Throws:
IOException

JSONGenerator

public JSONGenerator(String templateName)
              throws IOException
Throws:
IOException

JSONGenerator

public JSONGenerator(freemarker.template.Template template)
Method Detail

toJSON

public String toJSON(MetaBean metaBean)
              throws IOException,
                     freemarker.template.TemplateException
Throws:
IOException
freemarker.template.TemplateException

toJSON

public String toJSON(Collection<MetaBean> metaBeans)
              throws IOException,
                     freemarker.template.TemplateException
Throws:
IOException
freemarker.template.TemplateException

toJSON

public void toJSON(Collection<MetaBean> metaBeans,
                   Writer out)
            throws IOException,
                   freemarker.template.TemplateException
Throws:
IOException
freemarker.template.TemplateException


Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.