pax_global_header 0000666 0000000 0000000 00000000064 12150566573 0014524 g ustar 00root root 0000000 0000000 52 comment=b8d01a7df1c1f3c682200fdefe99f5a7291f729d
jackson-databind-jackson-databind-2.2.2/ 0000775 0000000 0000000 00000000000 12150566573 0020115 5 ustar 00root root 0000000 0000000 jackson-databind-jackson-databind-2.2.2/.gitignore 0000664 0000000 0000000 00000000235 12150566573 0022105 0 ustar 00root root 0000000 0000000 # use glob syntax.
syntax: glob
*.class
*~
*.bak
*.off
*.old
.DS_Store
# building
target
# Eclipse
.classpath
.project
.settings
# IDEA
*.iml
*.ipr
*.iws
jackson-databind-jackson-databind-2.2.2/README.md 0000664 0000000 0000000 00000035622 12150566573 0021404 0 ustar 00root root 0000000 0000000 # Overview
This project contains the general-purpose data-binding functionality
and tree-model for [Jackson Data Processor](http://wiki.fasterxml.com/JacksonHome)
It builds on [core streaming parser/generator](https://github.com/FasterXML/jackson-core) package,
and uses [Jackson Annotations](https://github.com/FasterXML//jackson-annotations) for configuration.
While the original use case for Jackson was JSON data-binding,
it can now be used for other data formats as well, as long as
parser and generator implementations exist.
Naming of classes uses word 'JSON' in many places even though there is no
actual hard dependency to JSON format.
[](https://fasterxml.ci.cloudbees.com/job/jackson-databind-master/)
### Differences from Jackson 1.x
Project contains versions 2.0 and above: source code for earlier (1.x) versions is available from [Codehaus](http://jackson.codehaus.org) SVN repository
Main differences compared to 1.0 "mapper" jar are:
* Maven build instead of Ant
* Java package is now `com.fasterxml.jackson.databind` (instead of `org.codehaus.jackson.map`)
-----
# Get it!
## Maven
Functionality of this package is contained in Java package `com.fasterxml.jackson.databind`, and can be used using following Maven dependency:
```xml
com.fasterxml.jackson.corejackson-databind2.2.0
```
Since package also depends on '''jackson-core''' and '''jackson-databind''' packages, you will need to download these if not using Maven; and you may also want to add them as Maven dependency to ensure that compatible versions are used.
If so, also add:
```xml
com.fasterxml.jackson.corejackson-annotations2.2.0com.fasterxml.jackson.corejackson-core2.2.0
```
but note that this is optional, and only necessary if there are conflicts between jackson core dependencies through transitive dependencies.
## Non-Maven
For non-Maven use cases, you download jars from [Central Maven repository](http://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/) or [Download page](https://github.com/FasterXML/jackson-databind/wiki/JacksonDownload).
Databind jar is also a functional OSGi bundle, with proper import/export declarations, so it can be use on OSGi container as is.
-----
# Use It!
While wiki contains more documentation, here are brief introductionary tutorials, in recommended order of reading.
## 1 minute tutorial: POJOs to JSON and back
The most common usage is to take piece of JSON, and construct a Plain Old Java Object ("POJO") out of it. So let's start there.
All data binding starts with a `com.fasterxml.jackson.databind.ObjectMapper` instance, so let's construct one:
```java
ObjectMapper mapper = new ObjectMapper(); // create once, reuse
```
The default instance is fine for our use -- we will learn later on how to configure mapper instance if necessary. Usage is simple:
```java
MyValue value = mapper.readValue(new File("data.json"), MyValue.class);
// or:
value = mapper.readValue(new URL("http://some.com/api/entry.json"), MyValue.class);
// or:
value = mapper.readValue("{\"name\":\"Bob\", \"age\":13}", MyValue.class);
```
And if we want to write JSON, we do the reverse:
```java
mapper.writeValue(new File("result.json"), myResultObject);
// or:
byte[] jsonBytes = mapper.writeValueAsBytes(myResultObject);
// or:
String jsonString = mapper.writeValueAsString(myResultObject);
```
So far so good?
## 3 minute tutorial: Generic collections, Tree Model
Beyond dealing with simple Bean-style POJOs, you can also handle JDK `List`s, `Map`s:
```java
Map scoreByName = mapper.readValue(jsonSource, Map.class);
List names = mapper.readValue(jsonSource, List.class);
// and can obviously write out as well
mapper.writeValue(new File("names.json"), names);
```
as long as JSON structure matches, and types are simple.
If you have POJO values, you need to indicate actual type (note: this is NOT needed for POJO properties with `List` etc types):
```java
Map results = mapper.readValue(jsonSource,
new TypeReference() { } );
// why extra work? Java Type Erasure will prevent type detection otherwise
```
(note: no extra effort needed for serialization, regardless of generic types)
But wait! There is more!
While dealing with `Map`s, `List`s and other "simple" Object types (Strings, Numbers, Booleans) can be simple, Object traversal can be cumbersome.
This is where Jackson's [Tree model](https://github.com/FasterXML/jackson-databind/wiki/JacksonTreeModel) can come in handy:
```java
// can be read as generic JsonNode, if it can be Object or Array; or,
// if known to be Object, as ObjectNode, if array, ArrayNode etc:
ObjectNode root = mapper.readTree("stuff.json");
String name = root.get("name").asText();
int age = root.get("age").asInt();
// can modify as well: this adds child Object as property 'other', set property 'type'
root.with("other").put("type", "student");
String json = mapper.writeValueAsString(root);
// with above, we end up with something like as 'json' String:
// {
// "name" : "Bob", "age" : 13,
// "other" : {
// "type" : "student"
// {
// }
```
Tree Model can be more convenient than data-binding, especially in cases where structure is highly dynamic, or does not map nicely to Java classes.
## 5 minute tutorial: Streaming parser, generator
As convenient as data-binding (to/from POJOs) can be; and as flexible as Tree model can be, there is one more canonical processing model available: incremental (aka "streaming") model.
It is the underlying processing model that data-binding and Tree Model both build upon, but it is also exposed to users who want ultimate performance and/or control over parsing or generation details.
For in-depth explanation, look at [Jackson Core component](https://github.com/FasterXML/jackson-core).
But let's look at a simple teaser to whet your appetite:
(TO BE COMPLETED)
## 10 minute tutorial: configuration
There are two entry-level configuration mechanisms you are likely to use:
[Features](https://github.com/FasterXML/jackson-databind/wiki/JacksonFeatures) and [Annotations](https://github.com/FasterXML/jackson-annotations).
### Commonly used Features
Here are examples of configuration features that you are most likely to need to know about.
Let's start with higher-level data-binding configuration.
```java
// SerializationFeature for changing how JSON is written
// to enable standard indentation ("pretty-printing"):
mapper.enable(SerializationFeature.INDENT_OUTPUT);
// to allow serialization of "empty" POJOs (no properties to serialize)
// (without this setting, an exception is thrown in those cases)
mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
// to write java.util.Date, Calendar as number (timestamp):
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
// DeserializationFeature for changing how JSON is read as POJOs:
// to prevent exception when encountering unknown property:
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
// to allow coercion of JSON empty String ("") to null Object value:
mapper.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
```
In addition, you may need to change some of low-level JSON parsing, generation details:
```java
// JsonParser.Feature for configuring parsing settings:
// to allow C/C++ style comments in JSON (non-standard, disabled by default)
mapper.enable(JsonParser.Feature.ALLOW_COMMENTS);
// to allow (non-standard) unquoted field names in JSON:
mapper.enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES);
// to allow use of apostrophes (single quotes), non standard
mapper.enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES);
// JsonGenerator.Feature for configuring low-level JSON generation:
// to force escaping of non-ASCII characters:
mapper.enable(JsonGenerator.Feature.ESCAPE_NON_ASCII);
```
Full set of features are explained on [Jackson Features](https://github.com/FasterXML/jackson-databind/wiki/JacksonFeatures) page.
### Annotations: changing property names
The simplest annotation-based approach is to use `@JsonProperty` annotation like so:
```java
public class MyBean {
private String _name;
// without annotation, we'd get "theName", but we want "name":
@JsonProperty("name")
public String getTheName() { return _name; }
// note: it is enough to add annotation on just getter OR setter;
// so we can omit it here
public void setTheName(String n) { _name = n; }
}
```
There are other mechanisms to use for systematic naming changes: see [Custom Naming Convention](https://github.com/FasterXML/jackson-databind/wiki/JacksonCustomNamingConvention) for details.
Note, too, that you can use [Mix-in Annotations](https://github.com/FasterXML/jackson-databind/wiki/JacksonMixinAnnotations) to associate all annotations.
### Annotations: Ignoring properties
There are two main annotations that can be used to to ignore properties: `@JsonIgnore` for individual properties; and `@JsonIgnoreProperties` for per-class definition
```java
// means that if we see "foo" or "bar" in JSON, they will be quietly skipped
// regardless of whether POJO has such properties
@JsonIgnoreProperties({ "foo", "bar" })
public class MyBean
{
// will not be written as JSON; nor assigned from JSON:
@JsonIgnore
public String internal;
// no annotation, public field is read/written normally
public String external;
@JsonIgnore
public void setCode(int c) { _code = c; }
// note: will also be ignored because setter has annotation!
public int getCode() { return _code; }
}
```
As with renaming, note that annotations are "shared" between matching fields, getters and setters: if only one has `@JsonIgnore`, it affects others.
But it is also possible to use "split" annotations, to for example:
```java
public class ReadButDontWriteProps {
private String _name;
@JsonProperty public void setName(String n) { _name = n; }
@JsonIgnore public String getName() { return _name; }
}
```
in this case, no "name" property would be written out (since 'getter' is ignored); but if "name" property was found from JSON, it would be assigned to POJO property!
For a more complete explanation of all possible ways of ignoring properties when writing out JSON, check ["Filtering properties"](http://www.cowtowncoder.com/blog/archives/2011/02/entry_443.html) article.
### Annotations: using custom constructor
Unlike many other data-binding packages, Jackson does not require you to define "default constructor" (constructor that does not take arguments).
While it will use one if nothing else is available, you can easily define that an argument-taking constructor is used:
```java
public class CtorBean
{
public final String name;
public final int age;
@JsonCreator // constructor can be public, private, whatever
private CtorBean(@JsonProperty("name") String name,
@JsonProperty("age") int age)
{
this.name = name;
this.age = age;
}
}
```
Constructors are especially useful in supporting use of
[Immutable objects](http://www.cowtowncoder.com/blog/archives/2010/08/entry_409.html).
Alternatively, you can also define "factory methods":
```java
public class FactoryBean
{
// fields etc omitted for brewity
@JsonCreator
public static FactoryBean create(@JsonProperty("name") String name) {
// construct and return an instance
}
}
```
Note that use of a "creator method" does not preclude use of setters: you
can mix and match properties from constructor/factory method with ones that
are set via setters or directly using fields.
## Tutorial: fancier stuff, conversions
One useful (but not very widely known) feature of Jackson is its ability
to do arbitrary POJO-to-POJO conversions. Conceptually you can think of conversions as sequence of 2 steps: first, writing a POJO as JSON, and second, binding that JSON into another kind of POJO. Implementation just skips actual generation of JSON, and uses more efficient intermediate representation.
Conversations work between any compatible types, and invocation is as simple as:
```java
ResultType result = mapper.convertValue(sourceObject, ResultType.class);
```
and as long as source and result types are compatible -- that is, if to-JSON, from-JSON sequence would succeed -- things will "just work".
But here are couple of potentially useful use cases:
```java
// Convert from int[] to List
List sourceList = ...;
int[] ints = mapper.convertValue(sourceList, int[].class);
// Convert a POJO into Map!
Map propertyMap = mapper.convertValue(pojoValue, Map.class);
// ... and back
PojoType pojo = mapper.convertValue(propertyMap, PojoType.class);
// decode Base64! (default byte[] representation is base64-encoded String)
String base64 = "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz";
byte[] binary = mapper.convertValue(base64, byte[].class);
```
Basically, Jackson can work as a replacement for many Apache Commons components, for tasks like base64 encoding/decoding, and handling of "dyna beans" (Maps to/from POJOs).
# Contribute!
We would love to get your contribution, whether it's in form of bug reports, Requests for Enhancement (RFE), documentation, or code patches.
The primary mechanism for all of above is [GitHub Issues system](https://github.com/FasterXML/jackson-databind/issues).
## Basic rules for Code Contributions
There is really just one main rule, which is that to accept any code contribution, we need to get a filled Contributor License Agreement (CLA) from the author. One CLA is enough for any number of contributions, but we need one. Or, rather, companies that use our code want it. It keeps their lawyers less unhappy about Open Source usage.
## Limitation on Dependencies by Core Components
One additional limitation exists for so-called core components (streaming api, jackson-annotations and jackson-databind): no additional dependendies are allowed beyond:
* Core components may rely on any methods included in the supported JDK: currently core components are limited to JDK 1.5
* Jackson-databind (this package) depends on the other two (annotations, streaming).
This means that anything that has to rely on additional APIs or libraries needs to be built as an extension, usually a Jackson module.
-----
# Further reading
* [Documentation](https://github.com/FasterXML/jackson-databind/wiki/Documentation)
Related:
* [Core annotations](https://github.com/FasterXML/jackson-annotations) package defines annotations commonly used for configuring databinding details
* [Core parser/generator](https://github.com/FasterXML/jackson-core) package defines low-level incremental/streaming parsers, generators
* [Jackson Project Home](http://wiki.fasterxml.com/JacksonHome) has additional documentation (although much of it for Jackson 1.x)
jackson-databind-jackson-databind-2.2.2/backup/ 0000775 0000000 0000000 00000000000 12150566573 0021362 5 ustar 00root root 0000000 0000000 jackson-databind-jackson-databind-2.2.2/backup/TypeSerializerWrapper.java 0000664 0000000 0000000 00000011107 12150566573 0026541 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.databind.jsontype;
import java.io.IOException;
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.BeanProperty;
/**
* Helper class used in cases where we caller has to override source
* for type identifier, for example when serializing a value using
* a delegate or surrogate value, in which case type id is to be based
* on the original value, but serialization done using surrogate.
*
* @since 2.2
*/
public class TypeSerializerWrapper
extends TypeSerializer
{
/**
* Actual TypeSerializer to use
*/
protected final TypeSerializer _delegate;
protected final Object _value;
public TypeSerializerWrapper(TypeSerializer delegate, Object value)
{
_delegate = delegate;
_value = value;
}
/*
/**********************************************************
/* TypeSerializer implementation, metadata
/**********************************************************
*/
@Override
public TypeSerializer forProperty(BeanProperty prop) {
TypeSerializer d2 = _delegate.forProperty(prop);
if (d2 == _delegate) {
return this;
}
return new TypeSerializerWrapper(d2, _value);
}
@Override
public As getTypeInclusion() {
return _delegate.getTypeInclusion();
}
@Override
public String getPropertyName() {
return _delegate.getPropertyName();
}
@Override
public TypeIdResolver getTypeIdResolver() {
return _delegate.getTypeIdResolver();
}
/*
/**********************************************************
/* TypeSerializer implementation, actual write methods
/**********************************************************
*/
@Override
public void writeTypePrefixForScalar(Object value, JsonGenerator jgen)
throws IOException, JsonProcessingException {
_delegate.writeTypePrefixForScalar(_value, jgen);
}
@Override
public void writeTypePrefixForObject(Object value, JsonGenerator jgen)
throws IOException, JsonProcessingException {
_delegate.writeTypePrefixForObject(_value, jgen);
}
@Override
public void writeTypePrefixForArray(Object value, JsonGenerator jgen)
throws IOException, JsonProcessingException {
_delegate.writeTypePrefixForArray(_value, jgen);
}
@Override
public void writeTypeSuffixForScalar(Object value, JsonGenerator jgen)
throws IOException, JsonProcessingException {
_delegate.writeTypeSuffixForScalar(_value, jgen);
}
@Override
public void writeTypeSuffixForObject(Object value, JsonGenerator jgen)
throws IOException, JsonProcessingException {
_delegate.writeTypeSuffixForObject(_value, jgen);
}
@Override
public void writeTypeSuffixForArray(Object value, JsonGenerator jgen)
throws IOException, JsonProcessingException {
_delegate.writeTypeSuffixForArray(_value, jgen);
}
@Override
public void writeCustomTypePrefixForScalar(Object value,
JsonGenerator jgen, String typeId) throws IOException, JsonProcessingException {
_delegate.writeCustomTypePrefixForScalar(_value, jgen, typeId);
}
@Override
public void writeCustomTypePrefixForObject(Object value,
JsonGenerator jgen, String typeId) throws IOException, JsonProcessingException {
_delegate.writeCustomTypePrefixForObject(_value, jgen, typeId);
}
@Override
public void writeCustomTypePrefixForArray(Object value, JsonGenerator jgen,
String typeId) throws IOException, JsonProcessingException {
_delegate.writeCustomTypePrefixForArray(_value, jgen, typeId);
}
@Override
public void writeCustomTypeSuffixForScalar(Object value,
JsonGenerator jgen, String typeId) throws IOException, JsonProcessingException {
_delegate.writeCustomTypeSuffixForScalar(_value, jgen, typeId);
}
@Override
public void writeCustomTypeSuffixForObject(Object value,
JsonGenerator jgen, String typeId) throws IOException,
JsonProcessingException {
_delegate.writeCustomTypeSuffixForObject(_value, jgen, typeId);
}
@Override
public void writeCustomTypeSuffixForArray(Object value, JsonGenerator jgen,
String typeId) throws IOException, JsonProcessingException {
_delegate.writeCustomTypeSuffixForArray(_value, jgen, typeId);
}
}
jackson-databind-jackson-databind-2.2.2/create-test-report.sh 0000775 0000000 0000000 00000000050 12150566573 0024200 0 ustar 00root root 0000000 0000000 #!/bin/sh
mvn surefire-report:report
jackson-databind-jackson-databind-2.2.2/pom.xml 0000664 0000000 0000000 00000012404 12150566573 0021433 0 ustar 00root root 0000000 0000000
4.0.0com.fasterxmloss-parent10com.fasterxml.jackson.corejackson-databind2.2.2jackson-databindGeneral data-binding functionality for Jackson: works on core streaming APIhttp://wiki.fasterxml.com/JacksonHomescm:git:git@github.com:FasterXML/jackson-databind.gitscm:git:git@github.com:FasterXML/jackson-databind.githttp://github.com/FasterXML/jackson-databindjackson-databind-2.2.2
com.fasterxml.jackson.databind,
com.fasterxml.jackson.databind.annotation,
com.fasterxml.jackson.databind.cfg,
com.fasterxml.jackson.databind.deser,
com.fasterxml.jackson.databind.deser.impl,
com.fasterxml.jackson.databind.deser.std,
com.fasterxml.jackson.databind.exc,
com.fasterxml.jackson.databind.ext,
com.fasterxml.jackson.databind.introspect,
com.fasterxml.jackson.databind.jsonschema,
com.fasterxml.jackson.databind.jsonFormatVisitors,
com.fasterxml.jackson.databind.jsontype,
com.fasterxml.jackson.databind.jsontype.impl,
com.fasterxml.jackson.databind.module,
com.fasterxml.jackson.databind.node,
com.fasterxml.jackson.databind.ser,
com.fasterxml.jackson.databind.ser.impl,
com.fasterxml.jackson.databind.ser.std,
com.fasterxml.jackson.databind.type,
com.fasterxml.jackson.databind.util
com.fasterxml.jackson.annotation,
com.fasterxml.jackson.core,
com.fasterxml.jackson.core.base,
com.fasterxml.jackson.core.format,
com.fasterxml.jackson.core.json,
com.fasterxml.jackson.core.io,
com.fasterxml.jackson.core.util,
com.fasterxml.jackson.core.type,
org.xml.sax,org.w3c.dom, org.w3c.dom.bootstrap, org.w3c.dom.ls,
javax.xml.datatype, javax.xml.namespace, javax.xml.parsers
com/fasterxml/jackson/databind/cfgcom.fasterxml.jackson.databind.cfgcom.fasterxml.jackson.corejackson-annotations2.2.2com.fasterxml.jackson.corejackson-core2.2.2junitjunit4.10testcglibcglib2.2.2testorg.codehaus.groovygroovy1.7.9testorg.hibernatehibernate-cglib-repack2.1_3testorg.apache.maven.pluginsmaven-surefire-plugin${surefire.version}com/fasterxml/jackson/failing/*.javaorg.apache.maven.pluginsmaven-javadoc-plugin${javadoc.version}
http://docs.oracle.com/javase/6/docs/api/
http://fasterxml.github.com/jackson-annotations/javadoc/2.1.1/
http://fasterxml.github.com/jackson-core/javadoc/2.1.1/
com.google.code.maven-replacer-pluginreplacerprocess-packageVersionprocess-sourcesreleasetruetrue
jackson-databind-jackson-databind-2.2.2/release-notes/ 0000775 0000000 0000000 00000000000 12150566573 0022663 5 ustar 00root root 0000000 0000000 jackson-databind-jackson-databind-2.2.2/release-notes/CREDITS 0000664 0000000 0000000 00000005226 12150566573 0023710 0 ustar 00root root 0000000 0000000 Here are people who have contributed to development Jackson JSON processor
databind core component, version 2.x
(version numbers in brackets indicate release in which the problem was fixed)
(note: for older credits, check out release notes for 1.x versions)
Tatu Saloranta, tatu.saloranta@iki.fi: author
Pascal Glinas:
* Contributed fixes to 'MappingIterator' handling (Pull#58 and Pull#59)
(2.1.0)
* Reported #220: ContainerNode missing 'createNumber(BigInteger)'
(2.2.2)
Joern Huxhorn:
* Suggested [JACKSON-636]: Add 'SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS' to allow
forced sorting of Maps during serialization
(2.0.0)
James Roper:
* Requested [JACKSON-732]: Allow 'AnnotationIntrospector.findContentDeserializer()'
(and similar) to return instance, not just Class> for instance
(2.0.0)
* Suggested [JACKSON-800]: Adding a method for letting modules register
DeserializationProblemHandlers
(2.0.0)
Casey Lucas:
* Reported [JACKSON-798]: Problem with external type id, creators
(2.0.0)
Tammo van Lessen:
* Reported [JACKSON-811]: Problems with @JsonIdentityInfo, abstract types
(2.0.0)
* Reported [JACKSON-814]: Parsing RFC822/RFC1123 dates failes on non-US locales
(2.0.0)
Raymond Myers:
* Suggested [JACKSON-810]: Deserialization Feature: Allow unknown Enum values via
'DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL'
(2.0.0)
Ryan Gardner:
* Contributed [pull-5] -- Add support for maps with java.util.Locale keys
to the set of StdKeyDeserializers
(2.0.1)
Razvan Dragut:
* Suggested [JACKSON-850]: Allow use of zero-arg factory methods as "default creator"
(2.1.0)
Duncan Atkinson:
* Reported [JACKSON-851]: State corruption with ObjectWriter, DefaultPrettyPrinter
(2.1.0)
Mark Wolfe:
* Suggested [Issue#45]: Add `@JsonNaming()` for per-class naming strategy overrides
(2.1.0)
Dmitry Katsubo:
* Contributed patch for [Issue#65]: Add getters to `ObjectMapper`, DeserializationContext,
DeserializationFactory.
(2.1.0)
Francis Galiegue:
* Reported [Issue#93] (and suggested fix): bug in `ObjectMapper.setAll(...)'
implementation
(2.1.1)
kelaneren@github:
* Reported [Issue#157], contributed unit test: NPE when registering same module twice.
(2.1.4)
Eric Tschetter (cheddar@github):
* Reported issues #166, #167, #170 (regressions from 1.9.x to 2.x)
(2.1.4)
Thierry D (thierryd@github)
* Reported #214: Problem with LICENSE, NOTICE, Android packaging
(2.2.2)
Luke G-H (lukegh@github)
* Reported #223: Duplicated nulls with @JsonFormat(shape=Shape.ARRAY)
(2.2.2)
Karl Moore (karldmoore@github)
* Reported #217: JsonProcessingExceptions not all wrapped as expected
(2.2.2)
jackson-databind-jackson-databind-2.2.2/release-notes/VERSION 0000664 0000000 0000000 00000041143 12150566573 0023736 0 ustar 00root root 0000000 0000000 Project: jackson-databind
Version: 2.2.2 (26-May-2013)
Changes:
#216: Problems with Android, 1.6-only types
#217: JsonProcessingExceptions not all wrapped as expected
(reported by karldmoore@github)
#220: ContainerNode missing 'createNumber(BigInteger)'
(reported by Pascal G)
#223: Duplicated nulls with @JsonFormat(shape=Shape.ARRAY)
(reported by lukegh@github)
#226: Field mapping fail on deserialization to common referenced object when
@JsonUnwrapped is used
(reported by ikvia@github)
#232: Converting bound BigDecimal value to tree fails with WRITE_BIGDECIMAL_AS_PLAIN
(reported by celkings@github)
- Minor fix to handle primitive types for key deserializer lookups
- Add convenience method `MappingIterator.getCurrentLocation()`
(suggested by Tomdz@github)
------------------------------------------------------------------------
=== History: ===
------------------------------------------------------------------------
2.2.1 (03-May-2013)
#214: Problem with LICENSE, NOTICE, Android packaging
(reported by thierryd@github)
2.2.0 (22-Apr-2013)
Fixes:
#23: Fixing typing of root-level collections
#118: JsonTypeInfo.as.EXTERNAL_PROPERTY not working correctly
with missing type id, scalar types
#130: TimeZone not set for GregorianCalendar, even if configured
#144: MissingNode.isValueNode() should return 'false'
(reported by 'fge@github')
#146: Creator properties were not being renamed as expected
(contributed by Christoper C)
#188: Problem with ObjectId serialization, 'alwaysAsId' references
Improvements:
#116: JavaType implements `java.lang.reflect.Type` (as does `TypeReference`)
#147: Defer reporting of problems with missing creator parameters
(contributed by Christoper C)
#155: Make `ObjectNode` and `ArrayNode` final (other node types already were)
(requested by fge@github)
#161: Add deserializer for java.util.concurrent.ArrayBlockingQueue
#173: Add 'JsonNode.traverse(ObjectCodec)' for convenience
#181: Improve error reporting for missing '_valueDeserializer'
#194: Add `FloatNode` type in tree model (JsonNode)
(requested by msteiger@github)
#199: Allow deserializing `Iterable` instances (as basic `Collection`s)
(requested by electrum@github)
#206: Make 'ObjectMapper.createDeserializationContext()' overridable
(requested by noter@github)
#207: Add explicit support for `short` datatypes, for tree model
(contributed by msteiger@github)
New features:
#120: Extend BeanDeserializerModifier to work with non-POJO deserializers
#121: Extend BeanSerializerModifier to work with non-POJO serializers
#124: Add support for serialization converters (@JsonSerializer(converter=...))
#124: Add support for deserialization converters (@JsonDeserializer(converter=...))
#140: Add 'SerializationFeature.WRITE_BIGDECIMAL_AS_PLAIN' to allow forcing
of non-scientific notation when serializing BigDecimals.
(suggested by phedny@github)
#148: Add 'DeserializationFeature.FAIL_ON_INVALID_SUBTYPE`, which allows mapping
entries with missing or invalid type id into null references (instead of failing).
Also allows use of '@JsonTypeInfo.defaultImpl = NoClass.class' as alternative.
#159: Add more accessors in 'MappingIterator': getParser(), getParserSchema(),
readAll()
(suggested by Tom D)
#190: Add 'MapperFeature.ALLOW_FINAL_FIELDS_AS_MUTATORS' (default: true) for
pruning out final fields (to avoid using as mutators)
(requested by Eric T)
#195: Add 'MapperFeature.INFER_PROPERTY_MUTATORS' (default: enabled) for finer
control of what mutators are auto-detected.
(requested by Dain S)
#198: Add SPI metadata, handling in ObjectMapper (findModules()), for
automatic registration of auto-detected extension modules
(suggested by 'beamerblvd@github')
#203: Added new features to support advanced date/time handling:
- SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS
- DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS
- DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE
Other:
#126: Update JDK baseline to 1.6
* API under 'com.fasterxml.jackson.databind.jsonFormatVisitors' changed significantly
based on experiences with external JSON Schema generator.
* Version information accessed via code-generated access class, instead of reading
VERSION.txt
* Added 2 methods in Converter interface: getInputType(), getOutputType(),
to allow programmatic overrides (needed by JAXB annotation module)
2.1.4 (26-Feb-2013)
* [JACKSON-887]: StackOverflow with parameterized sub-class field
(reported by Alexander M)
* [#130]: TimeZone not set for GregorianCalendar, when deserializing
* [#157]: NPE when registering module twice
* [#162]: JsonNodeFactory: work around an old bug with BigDecimal and zero
(submitted by fge@github)
* [#166]: Incorrect optimization for `ObjectMapper.convertValue(Class)`
(reported by Eric T)
* [#167]: Problems with @JsonValue, polymorphic types (regression from 1.x)
(reported by Eric T)
* [#170]: Problems deserializing `java.io.File` if creator auto-discovery disabled
(reported by Eric T)
* [#175]: NPE for JsonMappingException, if no path is specified
(reported by bramp@github)
2.1.3 (19-Jan-2013)
* [Issue#141]: ACCEPT_EMPTY_STRING_AS_NULL_OBJECT not working for enums
* [Issue#142]: Serialization of class containing EnumMap with polymorphic enum
fails to generate class type data
(reported by kidavis4@github)
2.1.2 (04-Dec-2012)
* [Issue#106]: NPE in ObjectArraySerializer.createContextual(...)
* [Issue#117]: HandlerInstantiator defaulting not working
(reported by Alexander B)
* [Issue#118]: Problems with JsonTypeInfo.As.EXTERNAL_PROPERTY, scalar values
(reported by Adva11@github)
* [Issue#119]: Problems with @JsonValue, JsonTypeInfo.As.EXTERNAL_PROPERTY
(reported by Adva11@github)
* [Issue#122]: ObjectMapper.copy() was not copying underlying mix-in map
(reported by rzlo@github)
2.1.1 (11-Nov-2012)
Fixes:
* [JACKSON-875]: Enum values not found if Feature.USE_ANNOTATIONS disabled
(reported by Laurent P)
* [Issue#93]: ObjectNode.setAll() broken; would not add anything for
empty ObjectNodes.
(reported by Francis G)
* Making things implement java.io.Serializable:
- Issues: #94, #99, #100, #102
(reported by Sean B)
* [Issue#96]: Problem with JsonTypeInfo.As.EXTERNAL_PROPERTY, defaultImpl
(reported by Adva11@github)
2.1.0 (08-Oct-2012)
New minor version for 2.x series. Major improvements in multiple areas,
including:
- Dataformat auto-detection
- More `@JsonFormat.shape` variant to serialize Collections as
JSON Objects, POJOs as JSON Arrays (csv-like).
- Much more configuration accessible via ObjectReader, ObjectWriter
- New mechanism for JSON Schema generation, other uses (in future)
Fixes:
* [JACKSON-830]/[Issue#19]: Change OSGi bundle name to be fully-qualified
* ]JACKSON-847]: Make @JsonIdentityInfo work with property-based creator
* [JACKSON-851]: State corruption with ObjectWriter, DefaultPrettyPrinter
(reported by Duncan A)
* [Issue#75]: Too aggressive KeySerializer caching
* Minor fix wrt [Issue#11], coercion needed extra checks
Improvements:
* [JACKSON-758]: Remove 'IOException' from throws clauses of "writeValueAsString"
and "writeValueAsBytes" of ObjectMapper/ObjectWriter
(suggested by G-T Chen)
* [JACKSON-839]: Allow "upgrade" of integer number types for
UntypedObjectDeserializer, even with default typing enabled.
* [JACKSON-850]: Allow use of zero-arg factory methods as "default creator"
(suggested by Razvan D)
* [Issue#9]: Implement 'required' JSON Schema attribute for bean properties
* [Issue#20]: Add new exception type, InvalidFormatException (sub-type of
JsonMappingException) to indicate data format problems
(suggested by HolySamosa@github)
* [Issue#30]: ObjectReader and ObjectWriter now try to pre-fetch root
(de)serializer if possible; minor performance improvement (2% for small POJOs).
* [Issue#33]: Simplified/clarified definition of 'ObjectReader.readValues()';
minor change in behavior for JSON Array "wrapped" sequences
* [Issue#60]: Add 'JsonNode.hasNonNull(...)' method(s)
(suggested by Jeff S on mailing list)
* [Issue#64]: Add new "standard" PropertyNamingStrategy, PascalCaseStrategy
(PropertyNamingStrategy.PASCAL_CASE_TO_CAMEL_CASE)
(contributed by Sean B)
* [Issue#65]: Add getters to `ObjectMapper`, DeserializationContext/-Factory.
(contributed by Dmitry K)
* [Issue#69]: Add `PropertyName` abstraction, new methods in AnnotationIntrospector
* [Issue#80]: Make `DecimalNode` normalize input, to make "1.0" and "1.00"equal
(reported by fge@github)
New features:
* [Issue#15]: Support data format auto-detection via ObjectReader (added
'withFormatDetection(...)' fluent factories)
* [Issue#21]: Add 'ObjectNode.set(...)' method (and related) to improve
chaining, semantic consistency of Tree Model API
(suggested by fge@Github)
* [Issue#22]: Add 'ObjectMapper.setAnnotationIntrospectors()' which allows
defining different introspectors for serialization, deserialization
* [Issue#24]: Allow serialization of Enums as JSON Objects
(suggested by rveloso@github)
* [Issue#28]: Add 'ObjectMapper.copy()', to create non-linked copy of
mapper, with same configuration settings
* [Issue#29]: Allow serializing, deserializing POJOs as JSON Arrays
by using `@JsonFormat(shape=Shape.ARRAY)`
* [Issue#40]: Allow serialization of Collections as JSON Objects
(and deserialization from)
(suggested by 'rveloso@github')
* [Issue#42]: Allow specifying Base64 variant to use for Base64-encoded data
using ObjectReader.with(Base64Variant), ObjectWriter.with(Base64Variant).
(suggested by 'mpfau@github')
* [Issue#45]: Add '@JsonNaming' annotation to define per-class PropertyNamingStrategy
(suggested by Mark W)
* [Pull#58]: Make 'MappingIterator' implement 'Closable'
(contributed by Pascal G)
* [Issue#72]: Add 'MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME' to use
wrapper name annotations for renaming properties
* [Issue#87]: Add 'StdDelegatingSerializer', 'StdDelegatingDeserializer' to
simplify writing of two-step handlers
* (issue #4 of jackson-annotations): Add `@JsonIdentityReference(alwaysAsId=true)`
to force ALL references to an object written as Object Id, even the first one.
* Added 'ObjectReader#withHandler' to allow for reconfiguring deserialization
problem handler
(suggested by 'electricmonk')
Other changes:
* New variant of AnnotationIntrospector.getFormat(), to support class
annotations
* It is now possible to serialize instances of plain old Object, iff
'FAIL_ON_EMPTY_BEANS' is disabled.
* Trying to remove reference to "JSON" in datatype conversion errors
(since databinding is format-agnostic)
INCOMPATIBILITIES: (rats!)
* Note that [Issue#33] (see above) is, technically speaking, backwards
imcompatible change. It is estimated that it should NOT affect most
users, as changes are to edge cases (and undocumented ones at that).
However, it can potentially cause problems with upgrade.
* Implementation of `JsonFormatVisitable` resulting in 2 new methods
being added in `BeanPropertyFilter` interface -- this is unfortunate,
but was required to support full traversability.
2.0.4 (26-Jun-2012)
* [Issue#6]: element count for PrettyPrinter, endObject wrong
(reported by "thebluemountain")
* [JACKSON-838]: Utf8StreamParser._reportInvalidToken() skips letters
from reported token name
(reported by Lóránt Pintér)
* [JACKSON-841] Data is doubled in SegmentedStringWriter output
(reported by Scott S)
* [JACKSON-842] ArrayIndexOutOfBoundsException when skipping C-style comments
(reported by Sebastien R)
2.0.3: no version 2.0.3 released -- only used for extension modules
2.0.2 [14-May-2012]
Fixes:
* [Issue#14]: Annotations were not included from parent classes of
mix-in classes
(reported by @guillaup)
* [JACKSON-824]: Combination of JSON Views, ObjectMapper.readerForUpdating()
was not working
(reported by Nir S)
(and all fixes from 1.9.7)
Improvements:
* [Issue#11]: Improve ObjectMapper.convertValue()/.treeToValue() to use
cast if possible
2.0.1 [23-Apr-2012]
Fixes:
* [JACKSON-827] Ensure core packages work on JDK 1.5
(reported by Pascal g)
* [JACKSON-829] Custom serializers not working for List properties,
@JsonSerialize(contentUsing)
(reported by James R)
Improvements:
* [Issue#5]: Add support for maps with java.util.Locale keys to the set of
StdKeyDeserializers
(contributed by Ryan G)
2.0.0 [25-Mar-2012]
Fixes:
* [JACKSON-368]: Problems with managed references, abstract types
* [JACKSON-711]: Delegating @JsonCreator did not work with Injectable values
* [JACKSON-798]: Problem with external type id, creators
(reported by Casey L)
(and all fixes up until and including 1.9.6)
Improvements:
* [JACKSON-546]: Indicate end-of-input with JsonMappingException instead
of EOFException, when there is no parsing exception
* [JACKSON-664]: Reduce overhead of type resolution by adding caching
in TypeFactory
* [JACKSON-690]: Pass DeserializationContext through ValueInstantiator
* [JACKSON-695]: Add 'isEmpty(value)' in JsonSerializer to allow
customizing handling of serialization of empty values
* [JACKSON-710]: 'ObjectMapper.convertValue()' should ignore root value
wrapping/unwrapping settings
* [JACKSON-730] Split various features (JsonParser, JsonGenerator,
SerializationConfig, DeserializationConfig) into per-factory
features (MapperFeature, JsonFactory.Feature) an per
instance features (existing ones)
* [JACKSON-732]: Allow 'AnnotationIntrospector.findContentDeserializer()'
(and similar) to return instance, not just Class> for instance
(requested by James R)
* [JACKSON-736]: Add (more) access to array, container and map serializers
* [JACKSON-737]: Allow accessing of "creator properties" for BeanDeserializer
* [JACKSON-748]: Add 'registerSubtypes' to 'Module.setupContext' (and SimpleModule)
* [JACKSON-749]: Make @JsonValue work for Enum deserialization
* [JACKSON-769]: ObjectNode/ArrayNode: change 'put', 'insert', 'add' to return
'this node' (unless already returning something)
* [JACKSON-770]: Simplify method naming for JsonNode, drop unnecessary 'get' prefix
from methods like 'getTextValue()' (becomes 'textValue()')
* [JACKSON-777]: Rename 'SerializationConfig.Feature' as 'SerializationFeature',
'DeserializationConfig.Feature' as 'DeserializationFeature'
* [JACKSON-780]: MissingNode, NullNode should return 'defaultValue' from 'asXxx' methods,
(not 0 for numbers), as they are not numeric types
* [JACKSON-787]: Allow use of @JsonIgnoreProperties for properties (fields, getters, setters)
* [JACKSON-795]: @JsonValue was not working for Maps, Collections
* [JACKSON-800]: Add 'Module.SetupContext#addDeserializationProblemHandler'
(suggested by James R)
New features:
* [JACKSON-107]: Add support for Object Identity (to handled cycles, shared refs),
with @JsonIdentityInfo
* [JACKSON-435]: Allow per-property Date formatting using @JsonFormat.
* [JACKSON-437]: Allow injecting of type id as POJO property, by setting
new '@JsonTypeInfo.visible' property to true.
* [JACKSON-469]: Support "Builder pattern" for deserialiation; that is, allow
use of separate Builder object for data binding, creating actual value
* [JACKSON-608]: Allow use of JSON Views for deserialization
* [JACKSON-636]: Add 'SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS' to allow
forced sorting of Maps during serialization
(suggested by Joern H)
* [JACKSON-669]: Allow prefix/suffix for @JsonUnwrapped properties
(requested by Aner P)
* [JACKSON-707]: Add 'JsonNode.deepCopy()', to create safe deep copies
of ObjectNodes, ArrayNodes.
* [JACKSON-714]: Add general-purpose @JsonFormat annotation
* [JACKSON-718]: Added 'JsonNode.canConvertToInt()', 'JsonNode.canConvertToLong()'
* [JACKSON-747]: Allow changing of 'SerializationFeature' for ObjectWriter,
'DeserializationFeature' for ObjectReader.
* [JACKSON-752]: Add @JsonInclude (replacement of @JsonSerialize.include)
* [JACKSON-754]: Add @JacksonAnnotationsInside for creating "annotation
bundles" (also: AnnotationIntrospector.isAnnotationBundle())
* [JACKSON-762]: Allow using @JsonTypeId to specify property to use as
type id, instead of using separate type id resolver.
* [JACKSON-764]: Allow specifying "root name" to use for root wrapping
via ObjectReader, ObjectWriter.
* [JACKSON-772]: Add 'JsonNode.withArray()' to use for traversing Array nodes.
* [JACKSON-793]: Add support for configurable Locale, TimeZone to use
(via SerializationConfig, DeserializationConfig)
* [JACKSON-805]: Add 'SerializationFeature.WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED'
to improve interoperability with BadgerFish/Jettison
* [JACKSON-810]: Deserialization Feature: Allow unknown Enum values via
'DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL'
(suggested by Raymond R)
* [JACKSON-813]: Add '@JsonSerializableSchema.id' attribute, to indicate
'id' value to add to generated JSON Schemas.
[entries for versions 1.x and earlier not retained; refer to earlier releases)
jackson-databind-jackson-databind-2.2.2/src/ 0000775 0000000 0000000 00000000000 12150566573 0020704 5 ustar 00root root 0000000 0000000 jackson-databind-jackson-databind-2.2.2/src/main/ 0000775 0000000 0000000 00000000000 12150566573 0021630 5 ustar 00root root 0000000 0000000 jackson-databind-jackson-databind-2.2.2/src/main/java/ 0000775 0000000 0000000 00000000000 12150566573 0022551 5 ustar 00root root 0000000 0000000 jackson-databind-jackson-databind-2.2.2/src/main/java/com/ 0000775 0000000 0000000 00000000000 12150566573 0023327 5 ustar 00root root 0000000 0000000 jackson-databind-jackson-databind-2.2.2/src/main/java/com/fasterxml/ 0000775 0000000 0000000 00000000000 12150566573 0025334 5 ustar 00root root 0000000 0000000 jackson-databind-jackson-databind-2.2.2/src/main/java/com/fasterxml/jackson/ 0000775 0000000 0000000 00000000000 12150566573 0026764 5 ustar 00root root 0000000 0000000 jackson-databind-jackson-databind-2.2.2/src/main/java/com/fasterxml/jackson/databind/ 0000775 0000000 0000000 00000000000 12150566573 0030532 5 ustar 00root root 0000000 0000000 AbstractTypeResolver.java 0000664 0000000 0000000 00000004224 12150566573 0035447 0 ustar 00root root 0000000 0000000 jackson-databind-jackson-databind-2.2.2/src/main/java/com/fasterxml/jackson/databind package com.fasterxml.jackson.databind;
/**
* Defines interface for resolvers that can resolve abstract types into concrete
* ones; either by using static mappings, or possibly by materializing
* implementations dynamically.
*/
public abstract class AbstractTypeResolver
{
/**
* Try to locate a subtype for given abstract type, to either resolve
* to a concrete type, or at least to a more-specific (and hopefully supported)
* abstract type, one which may have registered deserializers.
* Method is called before trying to locate registered deserializers
* (as well as standard abstract type defaulting that core Jackson does),
* so it is typically implemented to add custom mappings of common abstract
* types (like specify which concrete implementation to use for binding
* {@link java.util.List}s).
*
* Note that this method does not necessarily have to do full resolution
* of bindings; that is, it is legal to return type that could be further
* resolved: caller is expected to keep calling this method on registered
* resolvers, until a concrete type is located.
*
* @param config Configuration in use; should always be of type
* DeserializationConfig
*/
public JavaType findTypeMapping(DeserializationConfig config, JavaType type) {
return null;
}
/**
* Method called to try to resolve an abstract type into
* concrete type (usually for purposes of deserializing),
* when no concrete implementation was found.
* It will be called after checking all other possibilities,
* including defaulting.
*
* @param config Configuration in use; should always be of type
* DeserializationConfig
* @param type Type for which materialization maybe needed
*
* @return Resolved concrete type (which should retain generic
* type parameters of input type, if any), if resolution succeeds;
* null if resolver does not know how to resolve type
*/
public JavaType resolveAbstractType(DeserializationConfig config,
JavaType type) {
return null;
}
}
AnnotationIntrospector.java 0000664 0000000 0000000 00000122112 12150566573 0036043 0 ustar 00root root 0000000 0000000 jackson-databind-jackson-databind-2.2.2/src/main/java/com/fasterxml/jackson/databind package com.fasterxml.jackson.databind;
import java.lang.annotation.Annotation;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.core.Versioned;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.deser.ValueInstantiator;
import com.fasterxml.jackson.databind.introspect.*;
import com.fasterxml.jackson.databind.jsontype.NamedType;
import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder;
import com.fasterxml.jackson.databind.util.Converter;
import com.fasterxml.jackson.databind.util.NameTransformer;
/**
* Abstract class that defines API used for introspecting annotation-based
* configuration for serialization and deserialization. Separated
* so that different sets of annotations can be supported, and support
* plugged-in dynamically.
*
* NOTE: due to rapid addition of new methods (and changes to existing methods),
* it is strongly recommended that custom implementations should not directly
* extend this class, but rather extend {@link NopAnnotationIntrospector}.
* This way added methods will not break backwards compatibility of custom annotation
* introspectors.
*/
@SuppressWarnings("serial")
public abstract class AnnotationIntrospector
implements Versioned, java.io.Serializable
{
/*
/**********************************************************
/* Helper types
/**********************************************************
*/
/**
* Value type used with managed and back references; contains type and
* logic name, used to link related references
*/
public static class ReferenceProperty
{
public enum Type {
/**
* Reference property that Jackson manages and that is serialized normally (by serializing
* reference object), but is used for resolving back references during
* deserialization.
* Usually this can be defined by using
* {@link com.fasterxml.jackson.annotation.JsonManagedReference}
*/
MANAGED_REFERENCE
/**
* Reference property that Jackson manages by suppressing it during serialization,
* and reconstructing during deserialization.
* Usually this can be defined by using
* {@link com.fasterxml.jackson.annotation.JsonBackReference}
*/
,BACK_REFERENCE
;
}
private final Type _type;
private final String _name;
public ReferenceProperty(Type t, String n) {
_type = t;
_name = n;
}
public static ReferenceProperty managed(String name) { return new ReferenceProperty(Type.MANAGED_REFERENCE, name); }
public static ReferenceProperty back(String name) { return new ReferenceProperty(Type.BACK_REFERENCE, name); }
public Type getType() { return _type; }
public String getName() { return _name; }
public boolean isManagedReference() { return _type == Type.MANAGED_REFERENCE; }
public boolean isBackReference() { return _type == Type.BACK_REFERENCE; }
}
/*
/**********************************************************
/* Factory methods
/**********************************************************
*/
/**
* Factory method for accessing "no operation" implementation
* of introspector: instance that will never find any annotation-based
* configuration.
*/
public static AnnotationIntrospector nopInstance() {
return NopAnnotationIntrospector.instance;
}
public static AnnotationIntrospector pair(AnnotationIntrospector a1, AnnotationIntrospector a2) {
return new AnnotationIntrospectorPair(a1, a2);
}
/*
/**********************************************************
/* Access to possibly chained introspectors (1.7)
/**********************************************************
*/
/**
* Method that can be used to collect all "real" introspectors that
* this introspector contains, if any; or this introspector
* if it is not a container. Used to get access to all container
* introspectors in their priority order.
*
* Default implementation returns a Singleton list with this introspector
* as contents.
* This usually works for sub-classes, except for proxy or delegating "container
* introspectors" which need to override implementation.
*/
public Collection allIntrospectors() {
return Collections.singletonList(this);
}
/**
* Method that can be used to collect all "real" introspectors that
* this introspector contains, if any; or this introspector
* if it is not a container. Used to get access to all container
* introspectors in their priority order.
*
* Default implementation adds this introspector in result; this usually
* works for sub-classes, except for proxy or delegating "container
* introspectors" which need to override implementation.
*/
public Collection allIntrospectors(Collection result) {
result.add(this);
return result;
}
/*
/**********************************************************
/* Default Versioned impl
/**********************************************************
*/
@Override
public abstract Version version();
/*
/**********************************************************
/* Meta-annotations (annotations for annotation types)
/**********************************************************
*/
/**
* Method called by framework to determine whether given annotation
* is handled by this introspector.
*
* @deprecated Not used since 2.0; deprecated since 2.1
*/
@Deprecated
public boolean isHandled(Annotation ann) {
return false;
}
/**
* Method for checking whether given annotation is considered an
* annotation bundle: if so, all meta-annotations it has will
* be used instead of annotation ("bundle") itself.
*
* @since 2.0
*/
public boolean isAnnotationBundle(Annotation ann) {
return false;
}
/*
/**********************************************************
/* General annotations (for classes, properties)
/**********************************************************
*/
/**
* Method for checking whether given annotated thing
* (type, or accessor) indicates that values
* referenced (values of type of annotated class, or
* values referenced by annotated property; latter
* having precedence) should include Object Identifier,
* and if so, specify details of Object Identity used.
*
* @since 2.0
*/
public ObjectIdInfo findObjectIdInfo(Annotated ann) {
return null;
}
/**
* Method for figuring out additional properties of an Object Identity reference
*
* @since 2.1
*/
public ObjectIdInfo findObjectReferenceInfo(Annotated ann, ObjectIdInfo objectIdInfo) {
return objectIdInfo;
}
/*
/**********************************************************
/* General class annotations
/**********************************************************
*/
/**
* Method for locating name used as "root name" (for use by
* some serializers when outputting root-level object -- mostly
* for XML compatibility purposes) for given class, if one
* is defined. Returns null if no declaration found; can return
* explicit empty String, which is usually ignored as well as null.
*
* NOTE: method signature changed in 2.1, to return {@link PropertyName}
* instead of String.
*/
public PropertyName findRootName(AnnotatedClass ac) {
return null;
}
/**
* Method for finding list of properties to ignore for given class
* (null is returned if not specified).
* List of property names is applied
* after other detection mechanisms, to filter out these specific
* properties from being serialized and deserialized.
*/
public String[] findPropertiesToIgnore(Annotated ac) {
return null;
}
/**
* Method for checking whether an annotation indicates that all unknown properties
*/
public Boolean findIgnoreUnknownProperties(AnnotatedClass ac) {
return null;
}
/**
* Method for checking whether properties that have specified type
* (class, not generics aware) should be completely ignored for
* serialization and deserialization purposes.
*
* @param ac Type to check
*
* @return Boolean.TRUE if properties of type should be ignored;
* Boolean.FALSE if they are not to be ignored, null for default
* handling (which is 'do not ignore')
*/
public Boolean isIgnorableType(AnnotatedClass ac) {
return null;
}
/**
* Method for finding if annotated class has associated filter; and if so,
* to return id that is used to locate filter.
*
* @return Id of the filter to use for filtering properties of annotated
* class, if any; or null if none found.
*/
public Object findFilterId(AnnotatedClass ac) {
return null;
}
/**
* Method for finding {@link PropertyNamingStrategy} for given
* class, if any specified by annotations; and if so, either return
* a {@link PropertyNamingStrategy} instance, or Class to use for
* creating instance
*
* @return Sub-class or instance of {@link PropertyNamingStrategy}, if one
* is specified for given class; null if not.
*
* @since 2.1
*/
public Object findNamingStrategy(AnnotatedClass ac) {
return null;
}
/*
/**********************************************************
/* Property auto-detection
/**********************************************************
*/
/**
* Method for checking if annotations indicate changes to minimum visibility levels
* needed for auto-detecting property elements (fields, methods, constructors).
* A baseline checker is given, and introspector is to either return it as is
* (if no annotations are found), or build and return a derived instance (using
* checker's build methods).
*/
public VisibilityChecker> findAutoDetectVisibility(AnnotatedClass ac,
VisibilityChecker> checker) {
return checker;
}
/*
/**********************************************************
/* Class annotations for Polymorphic type handling (1.5+)
/**********************************************************
*/
/**
* Method for checking if given class has annotations that indicate
* that specific type resolver is to be used for handling instances.
* This includes not only
* instantiating resolver builder, but also configuring it based on
* relevant annotations (not including ones checked with a call to
* {@link #findSubtypes}
*
* @param config Configuration settings in effect (for serialization or deserialization)
* @param ac Annotated class to check for annotations
* @param baseType Base java type of value for which resolver is to be found
*
* @return Type resolver builder for given type, if one found; null if none
*/
public TypeResolverBuilder> findTypeResolver(MapperConfig> config,
AnnotatedClass ac, JavaType baseType) {
return null;
}
/**
* Method for checking if given property entity (field or method) has annotations
* that indicate that specific type resolver is to be used for handling instances.
* This includes not only
* instantiating resolver builder, but also configuring it based on
* relevant annotations (not including ones checked with a call to
* {@link #findSubtypes}
*
* @param config Configuration settings in effect (for serialization or deserialization)
* @param am Annotated member (field or method) to check for annotations
* @param baseType Base java type of property for which resolver is to be found
*
* @return Type resolver builder for properties of given entity, if one found;
* null if none
*/
public TypeResolverBuilder> findPropertyTypeResolver(MapperConfig> config,
AnnotatedMember am, JavaType baseType) {
return null;
}
/**
* Method for checking if given structured property entity (field or method that
* has nominal value of Map, Collection or array type) has annotations
* that indicate that specific type resolver is to be used for handling type
* information of contained values.
* This includes not only
* instantiating resolver builder, but also configuring it based on
* relevant annotations (not including ones checked with a call to
* {@link #findSubtypes}
*
* @param config Configuration settings in effect (for serialization or deserialization)
* @param am Annotated member (field or method) to check for annotations
* @param containerType Type of property for which resolver is to be found (must be a container type)
*
* @return Type resolver builder for values contained in properties of given entity,
* if one found; null if none
*/
public TypeResolverBuilder> findPropertyContentTypeResolver(MapperConfig> config,
AnnotatedMember am, JavaType containerType) {
return null;
}
/**
* Method for locating annotation-specified subtypes related to annotated
* entity (class, method, field). Note that this is only guaranteed to be
* a list of directly
* declared subtypes, no recursive processing is guarantees (i.e. caller
* has to do it if/as necessary)
*
* @param a Annotated entity (class, field/method) to check for annotations
*/
public List findSubtypes(Annotated a) {
return null;
}
/**
* Method for checking if specified type has explicit name.
*
* @param ac Class to check for type name annotations
*/
public String findTypeName(AnnotatedClass ac) {
return null;
}
/*
/**********************************************************
/* General member (field, method/constructor) annotations
/**********************************************************
*/
/**
* Method for checking if given member indicates that it is part
* of a reference (parent/child).
*/
public ReferenceProperty findReferenceType(AnnotatedMember member) {
return null;
}
/**
* Method called to check whether given property is marked to be "unwrapped"
* when being serialized (and appropriately handled in reverse direction,
* i.e. expect unwrapped representation during deserialization).
* Return value is the name transformation to use, if wrapping/unwrapping
* should be done, or null if not -- note that transformation may simply
* be identity transformation (no changes).
*/
public NameTransformer findUnwrappingNameTransformer(AnnotatedMember member) {
return null;
}
/**
* Method called to check whether given property is marked to
* be ignored. This is used to determine whether to ignore
* properties, on per-property basis, usually combining
* annotations from multiple accessors (getters, setters, fields,
* constructor parameters).
*/
public boolean hasIgnoreMarker(AnnotatedMember m) {
return false;
}
/**
* Method called to find out whether given member expectes a value
* to be injected, and if so, what is the identifier of the value
* to use during injection.
* Type if identifier needs to be compatible with provider of
* values (of type {@link InjectableValues}); often a simple String
* id is used.
*
* @param m Member to check
*
* @return Identifier of value to inject, if any; null if no injection
* indicator is found
*/
public Object findInjectableValueId(AnnotatedMember m) {
return null;
}
/**
* Method that can be called to check whether this member has
* an annotation that suggests whether value for matching property
* is required or not.
*
* @since 2.0
*/
public Boolean hasRequiredMarker(AnnotatedMember m) {
return null;
}
/**
* Method for checking if annotated property (represented by a field or
* getter/setter method) has definitions for views it is to be included in.
* If null is returned, no view definitions exist and property is always
* included (or always excluded as per default view inclusion configuration);
* otherwise it will only be included for views included in returned
* array. View matches are checked using class inheritance rules (sub-classes
* inherit inclusions of super-classes)
*
* @param a Annotated property (represented by a method, field or ctor parameter)
* @return Array of views (represented by classes) that the property is included in;
* if null, always included (same as returning array containing Object.class)
*/
public Class>[] findViews(Annotated a) {
return null;
}
/**
* Method for finding format annotations for given member.
* Return value is typically used by serializers and/or
* deserializers to customize presentation aspects of the
* serialized value.
*
* @since 2.0
*
* @deprecated Since 2.1, use {@link #findFormat(Annotated)} instead.
*/
@Deprecated
public JsonFormat.Value findFormat(AnnotatedMember member) {
return null;
}
/**
* Method for finding format annotations for property or class.
* Return value is typically used by serializers and/or
* deserializers to customize presentation aspects of the
* serialized value.
*
* @since 2.1
*/
public JsonFormat.Value findFormat(Annotated memberOrClass) {
if (memberOrClass instanceof AnnotatedMember) {
return findFormat((AnnotatedMember) memberOrClass);
}
return null;
}
/**
* Method for checking whether given accessor claims to represent
* type id: if so, its value may be used as an override,
* instead of generated type id.
*
* @since 2.0
*/
public Boolean isTypeId(AnnotatedMember member) {
return null;
}
/**
* Method used to check if specified property has annotation that indicates
* that it should be wrapped in an element; and if so, name to use.
* Note that not all serializers and deserializers support use this method:
* currently (2.1) it is only used by XML-backed handlers.
*
* @return Wrapper name to use, if any, or {@link PropertyName#USE_DEFAULT}
* to indicate that no wrapper element should be used.
*
* @since 2.1
*/
public PropertyName findWrapperName(Annotated ann) {
return null;
}
/*
/**********************************************************
/* Serialization: general annotations
/**********************************************************
*/
/**
* Method for getting a serializer definition on specified method
* or field. Type of definition is either instance (of type
* {@link JsonSerializer}) or Class (of type
* Class); if value of different
* type is returned, a runtime exception may be thrown by caller.
*/
public Object findSerializer(Annotated am) {
return null;
}
/**
* Method for getting a serializer definition for keys of associated Map property.
* Type of definition is either instance (of type
* {@link JsonSerializer}) or Class (of type
* Class); if value of different
* type is returned, a runtime exception may be thrown by caller.
*/
public Object findKeySerializer(Annotated am) {
return null;
}
/**
* Method for getting a serializer definition for content (values) of
* associated Collection, array or Map property.
* Type of definition is either instance (of type
* {@link JsonSerializer}) or Class (of type
* Class); if value of different
* type is returned, a runtime exception may be thrown by caller.
*/
public Object findContentSerializer(Annotated am) {
return null;
}
/**
* Method for checking whether given annotated entity (class, method,
* field) defines which Bean/Map properties are to be included in
* serialization.
* If no annotation is found, method should return given second
* argument; otherwise value indicated by the annotation
*
* @return Enumerated value indicating which properties to include
* in serialization
*/
public JsonInclude.Include findSerializationInclusion(Annotated a, JsonInclude.Include defValue) {
return defValue;
}
/**
* Method for accessing annotated type definition that a
* method/field can have, to be used as the type for serialization
* instead of the runtime type.
* Type returned (if any) needs to be widening conversion (super-type).
* Declared return type of the method is also considered acceptable.
*
* @return Class to use instead of runtime type
*/
public Class> findSerializationType(Annotated a) {
return null;
}
/**
* Method for finding possible widening type definition that a property
* value can have, to define less specific key type to use for serialization.
* It should be only be used with {@link java.util.Map} types.
*
* @return Class specifying more general type to use instead of
* declared type, if annotation found; null if not
*/
public Class> findSerializationKeyType(Annotated am, JavaType baseType) {
return null;
}
/**
* Method for finding possible widening type definition that a property
* value can have, to define less specific key type to use for serialization.
* It should be only used with structured types (arrays, collections, maps).
*
* @return Class specifying more general type to use instead of
* declared type, if annotation found; null if not
*/
public Class> findSerializationContentType(Annotated am, JavaType baseType) {
return null;
}
/**
* Method for accessing declared typing mode annotated (if any).
* This is used for type detection, unless more granular settings
* (such as actual exact type; or serializer to use which means
* no type information is needed) take precedence.
*
* @return Typing mode to use, if annotation is found; null otherwise
*/
public JsonSerialize.Typing findSerializationTyping(Annotated a) {
return null;
}
/**
* Method for finding {@link Converter} that annotated entity
* (property or class) has indicated to be used as part of
* serialization. If not null, either has to be actual
* {@link Converter} instance, or class for such converter;
* and resulting converter will be used first to convert property
* value to converter target type, and then serializer for that
* type is used for actual serialization.
*
* This feature is typically used to convert internal values into types
* that Jackson can convert.
*
* Note also that this feature does not necessarily work well with polymorphic
* type handling, or object identity handling; if such features are needed
* an explicit serializer is usually better way to handle serialization.
*
* @param a Annotated property (field, method) or class to check for
* annotations
*
* @since 2.2
*/
public Object findSerializationConverter(Annotated a) {
return null;
}
/**
* Method for finding {@link Converter} that annotated property
* has indicated needs to be used for values of container type
* (this also means that method should only be called for properties
* of container types, List/Map/array properties).
*
* If not null, either has to be actual
* {@link Converter} instance, or class for such converter;
* and resulting converter will be used first to convert property
* value to converter target type, and then serializer for that
* type is used for actual serialization.
*
* Other notes are same as those for {@link #findSerializationConverter}
*
* @param a Annotated property (field, method) to check.
*
* @since 2.2
*/
public Object findSerializationContentConverter(AnnotatedMember a) {
return null;
}
/*
/**********************************************************
/* Serialization: class annotations
/**********************************************************
*/
/**
* Method for accessing defined property serialization order (which may be
* partial). May return null if no ordering is defined.
*/
public String[] findSerializationPropertyOrder(AnnotatedClass ac) {
return null;
}
/**
* Method for checking whether an annotation indicates that serialized properties
* for which no explicit is defined should be alphabetically (lexicograpically)
* ordered
*/
public Boolean findSerializationSortAlphabetically(AnnotatedClass ac) {
return null;
}
/*
/**********************************************************
/* Serialization: property annotations
/**********************************************************
*/
/**
* Method for checking whether given property accessors (method,
* field) has an annotation that suggests property name to use
* for serialization.
* Should return null if no annotation
* is found; otherwise a non-null name (possibly
* {@link PropertyName#USE_DEFAULT}, which means "use default heuristics").
*
* @param a Property accessor to check
*
* @return Name to use if found; null if not.
*
* @since 2.1
*/
public PropertyName findNameForSerialization(Annotated a)
{
// [Issue#69], need bit of delegation
// !!! TODO: in 2.2, remove old methods?
String name;
if (a instanceof AnnotatedField) {
name = findSerializationName((AnnotatedField) a);
} else if (a instanceof AnnotatedMethod) {
name = findSerializationName((AnnotatedMethod) a);
} else {
name = null;
}
if (name != null) {
if (name.length() == 0) { // empty String means 'default'
return PropertyName.USE_DEFAULT;
}
return new PropertyName(name);
}
return null;
}
/**
* Method for checking whether given method has an annotation
* that suggests property name associated with method that
* may be a "getter". Should return null if no annotation
* is found; otherwise a non-null String.
* If non-null value is returned, it is used as the property
* name, except for empty String ("") which is taken to mean
* "use standard bean name detection if applicable;
* method name if not".
*
* @deprecated Since 2.1 should use {@link #findNameForSerialization} instead
*/
@Deprecated
public String findSerializationName(AnnotatedMethod am) {
return null;
}
/**
* Method for checking whether given member field represent
* a serializable logical property; and if so, returns the
* name of that property.
* Should return null if no annotation is found (indicating it
* is not a serializable field); otherwise a non-null String.
* If non-null value is returned, it is used as the property
* name, except for empty String ("") which is taken to mean
* "use the field name as is".
*
* @deprecated Since 2.1 should use {@link #findNameForSerialization} instead
*/
@Deprecated
public String findSerializationName(AnnotatedField af) {
return null;
}
/**
* Method for checking whether given method has an annotation
* that suggests that the return value of annotated method
* should be used as "the value" of the object instance; usually
* serialized as a primitive value such as String or number.
*
* @return True if such annotation is found (and is not disabled);
* false if no enabled annotation is found
*/
public boolean hasAsValueAnnotation(AnnotatedMethod am) {
return false;
}
/**
* Method for determining the String value to use for serializing
* given enumeration entry; used when serializing enumerations
* as Strings (the standard method).
*
* @return Serialized enum value.
*/
public String findEnumValue(Enum> value) {
// as per [JACKSON-875], should use default here
return value.name();
}
/*
/**********************************************************
/* Deserialization: general annotations
/**********************************************************
*/
/**
* Method for getting a deserializer definition on specified method
* or field.
* Type of definition is either instance (of type
* {@link JsonDeserializer}) or Class (of type
* Class); if value of different
* type is returned, a runtime exception may be thrown by caller.
*/
public Object findDeserializer(Annotated am) {
return null;
}
/**
* Method for getting a deserializer definition for keys of
* associated Map property.
* Type of definition is either instance (of type
* {@link JsonDeserializer}) or Class (of type
* Class); if value of different
* type is returned, a runtime exception may be thrown by caller.
*/
public Object findKeyDeserializer(Annotated am) {
return null;
}
/**
* Method for getting a deserializer definition for content (values) of
* associated Collection, array or
* Map property.
* Type of definition is either instance (of type
* {@link JsonDeserializer}) or Class (of type
* Class); if value of different
* type is returned, a runtime exception may be thrown by caller.
*/
public Object findContentDeserializer(Annotated am) {
return null;
}
/**
* Method for accessing annotated type definition that a
* method can have, to be used as the type for serialization
* instead of the runtime type.
* Type must be a narrowing conversion
* (i.e.subtype of declared type).
* Declared return type of the method is also considered acceptable.
*
* @param baseType Assumed type before considering annotations
*
* @return Class to use for deserialization instead of declared type
*/
public Class> findDeserializationType(Annotated am, JavaType baseType) {
return null;
}
/**
* Method for accessing additional narrowing type definition that a
* method can have, to define more specific key type to use.
* It should be only be used with {@link java.util.Map} types.
*
* @param baseKeyType Assumed key type before considering annotations
*
* @return Class specifying more specific type to use instead of
* declared type, if annotation found; null if not
*/
public Class> findDeserializationKeyType(Annotated am, JavaType baseKeyType) {
return null;
}
/**
* Method for accessing additional narrowing type definition that a
* method can have, to define more specific content type to use;
* content refers to Map values and Collection/array elements.
* It should be only be used with Map, Collection and array types.
*
* @param baseContentType Assumed content (value) type before considering annotations
*
* @return Class specifying more specific type to use instead of
* declared type, if annotation found; null if not
*/
public Class> findDeserializationContentType(Annotated am, JavaType baseContentType) {
return null;
}
/**
* Method for finding {@link Converter} that annotated entity
* (property or class) has indicated to be used as part of
* deserialization.
* If not null, either has to be actual
* {@link Converter} instance, or class for such converter;
* and resulting converter will be used after Jackson has deserializer
* data into intermediate type (Converter input type), and Converter
* needs to convert this into its target type to be set as property value.
*
* This feature is typically used to convert intermediate Jackson types
* (that default deserializers can produce) into custom type instances.
*
* Note also that this feature does not necessarily work well with polymorphic
* type handling, or object identity handling; if such features are needed
* an explicit deserializer is usually better way to handle deserialization.
*
* @param a Annotated property (field, method) or class to check for
* annotations
*
* @since 2.2
*/
public Object findDeserializationConverter(Annotated a) {
return null;
}
/**
* Method for finding {@link Converter} that annotated property
* has indicated needs to be used for values of container type
* (this also means that method should only be called for properties
* of container types, List/Map/array properties).
*
* If not null, either has to be actual
* {@link Converter} instance, or class for such converter;
* and resulting converter will be used after Jackson has deserializer
* data into intermediate type (Converter input type), and Converter
* needs to convert this into its target type to be set as property value.
*
* Other notes are same as those for {@link #findDeserializationConverter}
*
* @param a Annotated property (field, method) to check.
*
* @since 2.2
*/
public Object findDeserializationContentConverter(AnnotatedMember a) {
return null;
}
/*
/**********************************************************
/* Deserialization: class annotations
/**********************************************************
*/
/**
* Method getting {@link ValueInstantiator} to use for given
* type (class): return value can either be an instance of
* instantiator, or class of instantiator to create.
*/
public Object findValueInstantiator(AnnotatedClass ac) {
return null;
}
/**
* Method for finding Builder object to use for constructing
* value instance and binding data (sort of combining value
* instantiators that can construct, and deserializers
* that can bind data).
*
* Note that unlike accessors for some helper Objects, this
* method does not allow returning instances: the reason is
* that builders have state, and a separate instance needs
* to be created for each deserialization call.
*
* @since 2.0
*/
public Class> findPOJOBuilder(AnnotatedClass ac) {
return null;
}
/**
* @since 2.0
*/
public JsonPOJOBuilder.Value findPOJOBuilderConfig(AnnotatedClass ac) {
return null;
}
/*
/**********************************************************
/* Deserialization: property annotations
/**********************************************************
*/
/**
* Method for checking whether given property accessors (method,
* field) has an annotation that suggests property name to use
* for deserialization (reading JSON into POJOs).
* Should return null if no annotation
* is found; otherwise a non-null name (possibly
* {@link PropertyName#USE_DEFAULT}, which means "use default heuristics").
*
* @param a Property accessor to check
*
* @return Name to use if found; null if not.
*
* @since 2.1
*/
public PropertyName findNameForDeserialization(Annotated a)
{
// [Issue#69], need bit of delegation
// !!! TODO: in 2.2, remove old methods?
String name;
if (a instanceof AnnotatedField) {
name = findDeserializationName((AnnotatedField) a);
} else if (a instanceof AnnotatedMethod) {
name = findDeserializationName((AnnotatedMethod) a);
} else if (a instanceof AnnotatedParameter) {
name = findDeserializationName((AnnotatedParameter) a);
} else {
name = null;
}
if (name != null) {
if (name.length() == 0) { // empty String means 'default'
return PropertyName.USE_DEFAULT;
}
return new PropertyName(name);
}
return null;
}
/**
* Method for checking whether given method has an annotation
* that suggests property name associated with method that
* may be a "setter". Should return null if no annotation
* is found; otherwise a non-null String.
* If non-null value is returned, it is used as the property
* name, except for empty String ("") which is taken to mean
* "use standard bean name detection if applicable;
* method name if not".
*
* @deprecated Since 2.1 should use {@link #findNameForDeserialization} instead
*/
@Deprecated
public String findDeserializationName(AnnotatedMethod am) {
return null;
}
/**
* Method for checking whether given member field represent
* a deserializable logical property; and if so, returns the
* name of that property.
* Should return null if no annotation is found (indicating it
* is not a deserializable field); otherwise a non-null String.
* If non-null value is returned, it is used as the property
* name, except for empty String ("") which is taken to mean
* "use the field name as is".
*
* @deprecated Since 2.1 should use {@link #findNameForDeserialization} instead
*/
@Deprecated
public String findDeserializationName(AnnotatedField af) {
return null;
}
/**
* Method for checking whether given set of annotations indicates
* property name for associated parameter.
* No actual parameter object can be passed since JDK offers no
* representation; just annotations.
*
* @deprecated Since 2.1 should use {@link #findNameForDeserialization} instead
*/
@Deprecated
public String findDeserializationName(AnnotatedParameter param) {
return null;
}
/**
* Method for checking whether given method has an annotation
* that suggests that the method is to serve as "any setter";
* method to be used for setting values of any properties for
* which no dedicated setter method is found.
*
* @return True if such annotation is found (and is not disabled),
* false otherwise
*/
public boolean hasAnySetterAnnotation(AnnotatedMethod am) {
return false;
}
/**
* Method for checking whether given method has an annotation
* that suggests that the method is to serve as "any setter";
* method to be used for accessing set of miscellaneous "extra"
* properties, often bound with matching "any setter" method.
*
* @return True if such annotation is found (and is not disabled),
* false otherwise
*/
public boolean hasAnyGetterAnnotation(AnnotatedMethod am) {
return false;
}
/**
* Method for checking whether given annotated item (method, constructor)
* has an annotation
* that suggests that the method is a "creator" (aka factory)
* method to be used for construct new instances of deserialized
* values.
*
* @return True if such annotation is found (and is not disabled),
* false otherwise
*/
public boolean hasCreatorAnnotation(Annotated a) {
return false;
}
/*
/**********************************************************
/* Helper classes
/**********************************************************
*/
/**
* Old version of {@link AnnotationIntrospectorPair}.
*
* @deprecated Starting with 2.1, use {@link AnnotationIntrospectorPair} instead.
*/
@Deprecated
public static class Pair
extends AnnotationIntrospectorPair
{
private static final long serialVersionUID = 1L;
@Deprecated
public Pair(AnnotationIntrospector p, AnnotationIntrospector s) {
super(p, s);
}
}
}
BeanDescription.java 0000664 0000000 0000000 00000020600 12150566573 0034365 0 ustar 00root root 0000000 0000000 jackson-databind-jackson-databind-2.2.2/src/main/java/com/fasterxml/jackson/databind package com.fasterxml.jackson.databind;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import com.fasterxml.jackson.databind.introspect.*;
import com.fasterxml.jackson.databind.type.TypeBindings;
import com.fasterxml.jackson.databind.util.Annotations;
import com.fasterxml.jackson.databind.util.Converter;
/**
* Basic container for information gathered by {@link ClassIntrospector} to
* help in constructing serializers and deserializers.
* Note that the main implementation type is
* {@link com.fasterxml.jackson.databind.introspect.BasicBeanDescription},
* meaning that it is safe to upcast to this type.
*/
public abstract class BeanDescription
{
/*
/**********************************************************
/* Configuration
/**********************************************************
*/
/**
* Bean type information, including raw class and possible
* * generics information
*/
protected final JavaType _type;
/*
/**********************************************************
/* Life-cycle
/**********************************************************
*/
protected BeanDescription(JavaType type)
{
_type = type;
}
/*
/**********************************************************
/* Simple accesors
/**********************************************************
*/
/**
* Method for accessing declared type of bean being introspected,
* including full generic type information (from declaration)
*/
public JavaType getType() { return _type; }
public Class> getBeanClass() { return _type.getRawClass(); }
/**
* Method for accessing low-level information about Class this
* item describes.
*/
public abstract AnnotatedClass getClassInfo();
/**
* Accessor for getting information about Object Id expected to
* be used for this POJO type, if any.
*/
public abstract ObjectIdInfo getObjectIdInfo();
/**
* Method for checking whether class being described has any
* annotations recognized by registered annotation introspector.
*/
public abstract boolean hasKnownClassAnnotations();
/**
* Accessor for type bindings that may be needed to fully resolve
* types of member object, such as return and argument types of
* methods and constructors, and types of fields.
*/
public abstract TypeBindings bindingsForBeanType();
/**
* Method for resolving given JDK type, using this bean as the
* generic type resolution context.
*/
public abstract JavaType resolveType(java.lang.reflect.Type jdkType);
/**
* Method for accessing collection of annotations the bean
* class has.
*/
public abstract Annotations getClassAnnotations();
/*
/**********************************************************
/* Basic API for finding properties
/**********************************************************
*/
/**
* @return Ordered Map with logical property name as key, and
* matching getter method as value.
*/
public abstract List findProperties();
/**
* Method for locating all back-reference properties (setters, fields) bean has
*/
public abstract Map findBackReferenceProperties();
public abstract Set getIgnoredPropertyNames();
/*
/**********************************************************
/* Basic API for finding creator members
/**********************************************************
*/
public abstract List getConstructors();
public abstract List getFactoryMethods();
/**
* Method that will locate the no-arg constructor for this class,
* if it has one, and that constructor has not been marked as
* ignorable.
*/
public abstract AnnotatedConstructor findDefaultConstructor();
/**
* Method that can be called to locate a single-arg constructor that
* takes specified exact type (will not accept supertype constructors)
*
* @param argTypes Type(s) of the argument that we are looking for
*/
public abstract Constructor> findSingleArgConstructor(Class>... argTypes);
/**
* Method that can be called to find if introspected class declares
* a static "valueOf" factory method that returns an instance of
* introspected type, given one of acceptable types.
*
* @param expArgTypes Types that the matching single argument factory
* method can take: will also accept super types of these types
* (ie. arg just has to be assignable from expArgType)
*/
public abstract Method findFactoryMethod(Class>... expArgTypes);
/*
/**********************************************************
/* Basic API for finding property accessors
/**********************************************************
*/
public abstract AnnotatedMember findAnyGetter();
/**
* Method used to locate the method of introspected class that
* implements {@link com.fasterxml.jackson.annotation.JsonAnySetter}. If no such method exists
* null is returned. If more than one are found, an exception
* is thrown.
* Additional checks are also made to see that method signature
* is acceptable: needs to take 2 arguments, first one String or
* Object; second any can be any type.
*/
public abstract AnnotatedMethod findAnySetter();
/**
* Method for locating the getter method that is annotated with
* {@link com.fasterxml.jackson.annotation.JsonValue} annotation,
* if any. If multiple ones are found,
* an error is reported by throwing {@link IllegalArgumentException}
*/
public abstract AnnotatedMethod findJsonValueMethod();
public abstract AnnotatedMethod findMethod(String name, Class>[] paramTypes);
/*
/**********************************************************
/* Basic API, class configuration
/**********************************************************
*/
public abstract JsonInclude.Include findSerializationInclusion(JsonInclude.Include defValue);
/**
* Method for checking what is the expected format for POJO, as
* defined by defaults and possible annotations.
* Note that this may be further refined by per-property annotations.
*
* @since 2.1
*/
public abstract JsonFormat.Value findExpectedFormat(JsonFormat.Value defValue);
/**
* Method for finding {@link Converter} used for serializing instances
* of this class.
*
* @since 2.2
*/
public abstract Converter