com.fasterxml.jackson.dataformat.csv
Class CsvMapper

java.lang.Object
  extended by com.fasterxml.jackson.core.ObjectCodec
      extended by com.fasterxml.jackson.databind.ObjectMapper
          extended by com.fasterxml.jackson.dataformat.csv.CsvMapper
All Implemented Interfaces:
com.fasterxml.jackson.core.Versioned

public class CsvMapper
extends com.fasterxml.jackson.databind.ObjectMapper

Specialized ObjectMapper, with extended functionality to produce CsvSchema instances out of POJOs.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.ObjectMapper
com.fasterxml.jackson.databind.ObjectMapper.DefaultTypeResolverBuilder, com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping
 
Field Summary
protected  LRUMap<com.fasterxml.jackson.databind.JavaType,CsvSchema> _typedSchemas
          Simple caching for schema instances, given that they are relatively expensive to construct; this one is for typed schemas
protected  LRUMap<com.fasterxml.jackson.databind.JavaType,CsvSchema> _untypedSchemas
          Simple caching for schema instances, given that they are relatively expensive to construct; this one is for "loose" (non-typed) schemas
 
Fields inherited from class com.fasterxml.jackson.databind.ObjectMapper
_deserializationConfig, _deserializationContext, _injectableValues, _jsonFactory, _mixInAnnotations, _rootDeserializers, _rootNames, _serializationConfig, _serializerFactory, _serializerProvider, _subtypeResolver, _typeFactory, DEFAULT_ANNOTATION_INTROSPECTOR, DEFAULT_BASE, DEFAULT_INTROSPECTOR, STD_VISIBILITY_CHECKER
 
Constructor Summary
CsvMapper()
           
CsvMapper(CsvFactory f)
           
 
Method Summary
protected  CsvSchema.ColumnType _determineType(Class<?> propType)
           
protected  CsvSchema _schemaFor(com.fasterxml.jackson.databind.JavaType pojoType, LRUMap<com.fasterxml.jackson.databind.JavaType,CsvSchema> schemas, boolean typed)
           
 CsvMapper configure(CsvGenerator.Feature f, boolean state)
           
 CsvMapper configure(CsvParser.Feature f, boolean state)
           
 CsvMapper disable(CsvGenerator.Feature f)
           
 CsvMapper disable(CsvParser.Feature f)
           
 CsvMapper enable(CsvGenerator.Feature f)
           
 CsvMapper enable(CsvParser.Feature f)
           
 CsvFactory getCsvFactory()
          Type-safe accessor for accessing underlying CSV-specific JsonFactory implementation
 CsvFactory getJsonFactory()
          Overridden with more specific type, since factory we have is always of type CsvFactory
 com.fasterxml.jackson.databind.ObjectReader reader(com.fasterxml.jackson.core.FormatSchema schema)
           
 com.fasterxml.jackson.databind.ObjectReader readerWithSchemaFor(Class<?> pojoType)
          Convenience method which is functionally equivalent to:
 com.fasterxml.jackson.databind.ObjectReader readerWithTypedSchemaFor(Class<?> pojoType)
          Convenience method which is functionally equivalent to:
 CsvSchema schemaFor(Class<?> pojoType)
           
 CsvSchema schemaFor(com.fasterxml.jackson.databind.JavaType pojoType)
          Method that can be used to determine a CSV schema to use for given POJO type, using default serialization settings including ordering.
 CsvSchema schemaFor(com.fasterxml.jackson.core.type.TypeReference<?> pojoTypeRef)
           
 CsvSchema typedSchemaFor(Class<?> pojoType)
           
 CsvSchema typedSchemaFor(com.fasterxml.jackson.databind.JavaType pojoType)
          Method that can be used to determine a CSV schema to use for given POJO type, using default serialization settings including ordering.
 CsvSchema typedSchemaFor(com.fasterxml.jackson.core.type.TypeReference<?> pojoTypeRef)
           
 com.fasterxml.jackson.databind.ObjectWriter writer(com.fasterxml.jackson.core.FormatSchema schema)
           
 
Methods inherited from class com.fasterxml.jackson.databind.ObjectMapper
_configAndWriteValue, _configAndWriteValue, _convert, _defaultPrettyPrinter, _findRootDeserializer, _initForReading, _readMapAndClose, _readValue, _serializerProvider, _unwrapAndDeserialize, addHandler, addMixInAnnotations, canDeserialize, canSerialize, clearProblemHandlers, configure, configure, configure, configure, configure, constructType, convertValue, convertValue, convertValue, createArrayNode, createDeserializationContext, createObjectNode, disable, disable, disable, disable, disable, disableDefaultTyping, enable, enable, enable, enable, enable, enableDefaultTyping, enableDefaultTyping, enableDefaultTyping, enableDefaultTypingAsProperty, findMixInClassFor, generateJsonSchema, getDeserializationConfig, getNodeFactory, getSerializationConfig, getSerializerProvider, getSubtypeResolver, getTypeFactory, getVisibilityChecker, isEnabled, isEnabled, isEnabled, isEnabled, isEnabled, isEnabled, mixInCount, reader, reader, reader, reader, reader, reader, reader, reader, readerForUpdating, readerWithView, readTree, readTree, readTree, readTree, readTree, readTree, readTree, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValues, readValues, readValues, readValues, registerModule, registerSubtypes, registerSubtypes, setAnnotationIntrospector, setDateFormat, setDefaultTyping, setFilters, setHandlerInstantiator, setInjectableValues, setLocale, setMixInAnnotations, setNodeFactory, setPropertyNamingStrategy, setSerializationInclusion, setSerializerFactory, setSerializerProvider, setSubtypeResolver, setTimeZone, setTypeFactory, setVisibility, setVisibilityChecker, treeAsTokens, treeToValue, valueToTree, version, writer, writer, writer, writer, writer, writer, writerWithDefaultPrettyPrinter, writerWithType, writerWithType, writerWithType, writerWithView, writeTree, writeValue, writeValue, writeValue, writeValue, writeValueAsBytes, writeValueAsString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_untypedSchemas

protected final LRUMap<com.fasterxml.jackson.databind.JavaType,CsvSchema> _untypedSchemas
Simple caching for schema instances, given that they are relatively expensive to construct; this one is for "loose" (non-typed) schemas


_typedSchemas

protected final LRUMap<com.fasterxml.jackson.databind.JavaType,CsvSchema> _typedSchemas
Simple caching for schema instances, given that they are relatively expensive to construct; this one is for typed schemas

Constructor Detail

CsvMapper

public CsvMapper()

CsvMapper

public CsvMapper(CsvFactory f)
Method Detail

configure

public CsvMapper configure(CsvGenerator.Feature f,
                           boolean state)

configure

public CsvMapper configure(CsvParser.Feature f,
                           boolean state)

enable

public CsvMapper enable(CsvGenerator.Feature f)

enable

public CsvMapper enable(CsvParser.Feature f)

disable

public CsvMapper disable(CsvGenerator.Feature f)

disable

public CsvMapper disable(CsvParser.Feature f)

getJsonFactory

public CsvFactory getJsonFactory()
Overridden with more specific type, since factory we have is always of type CsvFactory

Overrides:
getJsonFactory in class com.fasterxml.jackson.databind.ObjectMapper

getCsvFactory

public CsvFactory getCsvFactory()
Type-safe accessor for accessing underlying CSV-specific JsonFactory implementation


schemaFor

public CsvSchema schemaFor(com.fasterxml.jackson.databind.JavaType pojoType)
Method that can be used to determine a CSV schema to use for given POJO type, using default serialization settings including ordering. Definition will not be strictly typed (that is, all columns are just defined to be exposed as String tokens).


schemaFor

public final CsvSchema schemaFor(Class<?> pojoType)

schemaFor

public final CsvSchema schemaFor(com.fasterxml.jackson.core.type.TypeReference<?> pojoTypeRef)

typedSchemaFor

public CsvSchema typedSchemaFor(com.fasterxml.jackson.databind.JavaType pojoType)
Method that can be used to determine a CSV schema to use for given POJO type, using default serialization settings including ordering. Definition WILL be strictly typed: that is, code will try to determine type limitations which may make parsing more efficient (especially for numeric types like java.lang.Integer).


typedSchemaFor

public final CsvSchema typedSchemaFor(Class<?> pojoType)

typedSchemaFor

public final CsvSchema typedSchemaFor(com.fasterxml.jackson.core.type.TypeReference<?> pojoTypeRef)

reader

public com.fasterxml.jackson.databind.ObjectReader reader(com.fasterxml.jackson.core.FormatSchema schema)
Overrides:
reader in class com.fasterxml.jackson.databind.ObjectMapper

writer

public com.fasterxml.jackson.databind.ObjectWriter writer(com.fasterxml.jackson.core.FormatSchema schema)
Overrides:
writer in class com.fasterxml.jackson.databind.ObjectMapper

readerWithSchemaFor

public com.fasterxml.jackson.databind.ObjectReader readerWithSchemaFor(Class<?> pojoType)
Convenience method which is functionally equivalent to:
  reader(pojoType).withSchema(schemaFor(pojoType));
that is, constructs a ObjectReader which both binds to specified type and uses "loose" CsvSchema introspected from specified type (one without strict inferred typing).

Parameters:
pojoType - Type used both for data-binding (result type) and for schema introspection. NOTE: must NOT be an array or Collection type, since these only make sense for data-binding (like arrays of objects to bind), but not for schema construction (no CSV types can be mapped to arrays or Collections)

readerWithTypedSchemaFor

public com.fasterxml.jackson.databind.ObjectReader readerWithTypedSchemaFor(Class<?> pojoType)
Convenience method which is functionally equivalent to:
  reader(pojoType).withSchema(typedSchemaFor(pojoType));
that is, constructs a ObjectReader which both binds to specified type and uses "strict" CsvSchema introspected from specified type (one where typing is inferred).


_schemaFor

protected CsvSchema _schemaFor(com.fasterxml.jackson.databind.JavaType pojoType,
                               LRUMap<com.fasterxml.jackson.databind.JavaType,CsvSchema> schemas,
                               boolean typed)

_determineType

protected CsvSchema.ColumnType _determineType(Class<?> propType)


Copyright © 2012 fasterxml.com. All Rights Reserved.