Jackson Glossary: JsonFactory

Role

This is the main factory class for core package, which can be used to instantiate JsonParser and JsonGenerator instances, as well as defining default settings for those instances.

Instances are fully thread-safe when "configure-then-use" pattern is used (i.e. configuration is not thread-safe but usage is).

Usage

This class can be instantiated and used directly, when using JacksonStreamingApi; if so, you will do:

   1   JsonFactory factory = new JsonFactory();
   2   factory.configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, false); // all configuration before use
   3   JsonParser jp = factory.createJsonParser(new FileInputStream("content.json"));
   4   // ... then use

but more commonly it is only indirectly used via ObjectMapper instance, i.e. not visible to application code.

Sub-types


Back to Jackson Term Glossary


CategoryJackson

JsonFactory (last edited 2010-12-08 20:52:53 by TatuSaloranta)

Copyright ©2009 FasterXML, LLC