ObjectMapper
(usually on per-call basis).
* Usually property is not deserialized from JSON, although it possible
* to have injected value as default and still allow optional override
* from JSON.
*/
@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotation
public @interface JacksonInject
{
/**
* Logical id of the value to inject; if not specified (or specified
* as empty String), will use id based on declared type of property.
*/
public String value() default "";
}
jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonAnyGetter.java 0000664 0000000 0000000 00000001540 12373030577 0032131 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marker annotation that can be used to define a non-static,
* no-argument method or member field as something of a reverse of
* {@link JsonAnySetter} method; basically being used like a
* getter but such that contents of the returned Map (type must be
* {@link java.util.Map}) are serialized as if they were actual properties
* of the bean that contains method/field with this annotations.
* As with {@link JsonAnySetter}, only one property should be annotated
* with this annotation.
*/
@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotation
public @interface JsonAnyGetter
{
}
jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonAnySetter.java 0000664 0000000 0000000 00000001573 12373030577 0032153 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marker annotation that can be used to define a non-static,
* two-argument method (first argument name of property, second value
* to set), to be used as a "fallback" handler
* for all otherwise unrecognized properties found from JSON content.
* It is similar to {@link javax.xml.bind.annotation.XmlAnyElement}
* in behavior; and can only be used to denote a single property
* per type.
** If used, all otherwise unmapped key-value pairs from JSON Object values * are added to the property (of type Map or bean). */ @Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonAnySetter { } jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonAutoDetect.java 0000664 0000000 0000000 00000010624 12373030577 0032273 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.lang.reflect.Member; import java.lang.reflect.Modifier; /** * Class annotation that can be used to define which kinds of Methods * are to be detected by auto-detection. * Auto-detection means using name conventions * and/or signature templates to find methods to use for data binding. * For example, so-called "getters" can be auto-detected by looking for * public member methods that return a value, do not take argument, * and have prefix "get" in their name. *
* Pseudo-value NONE
means that all auto-detection is disabled
* for the specific class that annotation is applied to (including
* its super-types, but only when resolving that class).
* Pseudo-value ALWAYS
means that auto-detection is enabled
* for all method types for the class in similar way.
*
* The default value is ALWAYS
: that is, by default, auto-detection
* is enabled for all classes unless instructed otherwise.
*
* Starting with version 1.5, it is also possible to use more fine-grained * definitions, to basically define minimum visibility level needed. Defaults * are different for different types (getters need to be public; setters can * have any access modifier, for example). */ @Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonAutoDetect { /** * Enumeration for possible visibility thresholds (minimum visibility) * that can be used to limit which methods (and fields) are * auto-detected. */ public enum Visibility { /** * Value that means that all kinds of access modifiers are acceptable, * from private to public. */ ANY, /** * Value that means that any other access modifier other than 'private' * is considered auto-detectable. */ NON_PRIVATE, /** * Value that means access modifiers 'protected' and 'public' are * auto-detectable (and 'private' and "package access" == no modifiers * are not) */ PROTECTED_AND_PUBLIC, /** * Value to indicate that only 'public' access modifier is considered * auto-detectable. */ PUBLIC_ONLY, /** * Value that indicates that no access modifiers are auto-detectable: * this can be used to explicitly disable auto-detection for specified * types. */ NONE, /** * Value that indicates that default visibility level (whatever it is, * depends on context) is to be used. This usually means that inherited * value (from parent visibility settings) is to be used. */ DEFAULT; public boolean isVisible(Member m) { switch (this) { case ANY: return true; case NONE: return false; case NON_PRIVATE: return !Modifier.isPrivate(m.getModifiers()); case PROTECTED_AND_PUBLIC: if (Modifier.isProtected(m.getModifiers())) { return true; } // fall through to public case: case PUBLIC_ONLY: return Modifier.isPublic(m.getModifiers()); default: return false; } } } /** * Minimum visibility required for auto-detecting regular getter methods. */ Visibility getterVisibility() default Visibility.DEFAULT; /** * Minimum visibility required for auto-detecting is-getter methods. */ Visibility isGetterVisibility() default Visibility.DEFAULT; /** * Minimum visibility required for auto-detecting setter methods. */ Visibility setterVisibility() default Visibility.DEFAULT; /** * Minimum visibility required for auto-detecting Creator methods, * except for no-argument constructors (which are always detected * no matter what). */ Visibility creatorVisibility() default Visibility.DEFAULT; /** * Minimum visibility required for auto-detecting member fields. */ Visibility fieldVisibility() default Visibility.DEFAULT; } jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonBackReference.java 0000664 0000000 0000000 00000003315 12373030577 0032710 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation used to indicate that associated property is part of * two-way linkage between fields; and that its role is "child" (or "back") link. * Value type of the property must be a bean: it can not be a Collection, Map, * Array or enumeration. * Linkage is handled such that the property * annotated with this annotation is not serialized; and during deserialization, * its value is set to instance that has the "managed" (forward) link. *
* All references have logical name to allow handling multiple linkages; typical case * would be that where nodes have both parent/child and sibling linkages. If so, * pairs of references should be named differently. * It is an error for a class to have multiple back references with same name, * even if types pointed are different. *
* Note: only methods and fields can be annotated with this annotation: constructor * arguments should NOT be annotated, as they can not be either managed or back * references. */ @Target({ElementType.ANNOTATION_TYPE, ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonBackReference { /** * Logical have for the reference property pair; used to link managed and * back references. Default name can be used if there is just single * reference pair (for example, node class that just has parent/child linkage, * consisting of one managed reference and matching back reference) */ public String value() default "defaultReference"; } jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonCreator.java 0000664 0000000 0000000 00000002540 12373030577 0031627 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Marker annotation that can be used to define constructors and factory * methods as one to use for instantiating new instances of the associated * class. *
* NOTE: when annotating creator methods (constructors, factory methods), * method must either be: *
com.fasterxml.jackson.databind.ObjectMapper
(or objects
* it delegates to) providing matching filters by id.
*
* Filters to use are usually of type
* com.fasterxml.jackson.databind.ser.BeanPropertyFilter
and
* are registered through com.fasterxml.jackson.databind.ObjectMapper
*
* Since 2.3, this annotation can also be used on properties (fields, methods, * constructor parameters). */ @Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER // new in 2.3 }) @Retention(RetentionPolicy.RUNTIME) @com.fasterxml.jackson.annotation.JacksonAnnotation public @interface JsonFilter { /** * Id of filter to use; if empty String (""), no filter is to be used. */ public String value(); } jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonFormat.java 0000664 0000000 0000000 00000024765 12373030577 0031475 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.util.Locale; import java.util.TimeZone; /** * General-purpose annotation used for configuring details of how * values of properties are to be serialized. * Unlike most other Jackson annotations, annotation does not * have specific universal interpretation: instead, effect depends on datatype * of property being annotated (or more specifically, deserializer * and serializer being used). *
* Common uses include choosing between alternate representations -- for example, * whether {@link java.util.Date} is to be serialized as number (Java timestamp) * or String (such as ISO-8601 compatible time value) -- as well as configuring * exact details with {@link #pattern} property. *
* As of Jackson 2.1, known special handling include: *
toString()
);
* but it is also possible to use {@link Shape#OBJECT} to serialize (but not deserialize)
* {@link java.lang.Enum}s as JSON Objects (as if they were POJOs). NOTE: serialization
* as JSON Object only works with class annotation;
* will not work as per-property annotation.
* JsonSerializer
*/
public String pattern() default "";
/**
* Structure to use for serialization: definition of mapping depends on datatype,
* but usually has straight-forward counterpart in data format (JSON).
* Note that commonly only a subset of shapes is available; and if 'invalid' value
* is chosen, defaults are usually used.
*/
public Shape shape() default Shape.ANY;
/**
* {@link java.util.Locale} to use for serialization (if needed).
* Special value of {@link #DEFAULT_LOCALE}
* can be used to mean "just use the default", where default is specified
* by the serialization context, which in turn defaults to system
* defaults ({@link java.util.Locale#getDefault()}) unless explicitly
* set to another locale.
*/
public String locale() default DEFAULT_LOCALE;
/**
* {@link java.util.TimeZone} to use for serialization (if needed).
* Special value of {@link #DEFAULT_TIMEZONE}
* can be used to mean "just use the default", where default is specified
* by the serialization context, which in turn defaults to system
* defaults ({@link java.util.TimeZone#getDefault()}) unless explicitly
* set to another locale.
*/
public String timezone() default DEFAULT_TIMEZONE;
/*
/**********************************************************
/* Value enumeration(s), value class(es)
/**********************************************************
*/
/**
* Value enumeration used for indicating preferred Shape; translates
* loosely to JSON types, with some extra values to indicate less precise
* choices (i.e. allowing one of multiple actual shapes)
*/
public enum Shape
{
/**
* Marker enum value that indicates "default" (or "whatever") choice; needed
* since Annotations can not have null values for enums.
*/
ANY,
/**
* Value that indicates shape should not be structural (that is, not
* {@link #ARRAY} or {@link #OBJECT}, but can be any other shape.
*/
SCALAR,
/**
* Value that indicates that (JSON) Array type should be used.
*/
ARRAY,
/**
* Value that indicates that (JSON) Object type should be used.
*/
OBJECT,
/**
* Value that indicates that a numeric (JSON) type should be used
* (but does not specify whether integer or floating-point representation
* should be used)
*/
NUMBER,
/**
* Value that indicates that floating-point numeric type should be used
*/
NUMBER_FLOAT,
/**
* Value that indicates that integer number type should be used
* (and not {@link #NUMBER_FLOAT}).
*/
NUMBER_INT,
/**
* Value that indicates that (JSON) String type should be used.
*/
STRING,
/**
* Value that indicates that (JSON) boolean type
* (true, false) should be used.
*/
BOOLEAN
;
public boolean isNumeric() {
return (this == NUMBER) || (this == NUMBER_INT) || (this == NUMBER_FLOAT);
}
public boolean isStructured() {
return (this == OBJECT) || (this == ARRAY);
}
}
/**
* Helper class used to contain information from a single {@link JsonFormat}
* annotation.
*/
public static class Value
{
private final String pattern;
private final Shape shape;
private final Locale locale;
private final String timezoneStr;
// lazily constructed when created from annotations
private TimeZone _timezone;
public Value() {
this("", Shape.ANY, "", "");
}
public Value(JsonFormat ann) {
this(ann.pattern(), ann.shape(), ann.locale(), ann.timezone());
}
public Value(String p, Shape sh, String localeStr, String tzStr)
{
this(p, sh,
(localeStr == null || localeStr.length() == 0 || DEFAULT_LOCALE.equals(localeStr)) ?
null : new Locale(localeStr),
(tzStr == null || tzStr.length() == 0 || DEFAULT_TIMEZONE.equals(tzStr)) ?
null : tzStr,
null
);
}
/**
* @since 2.1
*/
public Value(String p, Shape sh, Locale l, TimeZone tz)
{
pattern = p;
shape = sh;
locale = l;
_timezone = tz;
timezoneStr = null;
}
/**
* @since 2.4
*/
public Value(String p, Shape sh, Locale l, String tzStr, TimeZone tz)
{
pattern = p;
shape = sh;
locale = l;
_timezone = tz;
timezoneStr = tzStr;
}
/**
* @since 2.1
*/
public Value withPattern(String p) {
return new Value(p, shape, locale, timezoneStr, _timezone);
}
/**
* @since 2.1
*/
public Value withShape(Shape s) {
return new Value(pattern, s, locale, timezoneStr, _timezone);
}
/**
* @since 2.1
*/
public Value withLocale(Locale l) {
return new Value(pattern, shape, l, timezoneStr, _timezone);
}
/**
* @since 2.1
*/
public Value withTimeZone(TimeZone tz) {
return new Value(pattern, shape, locale, null, tz);
}
public String getPattern() { return pattern; }
public Shape getShape() { return shape; }
public Locale getLocale() { return locale; }
/**
* Alternate access (compared to {@link #getTimeZone()}) which is useful
* when caller just wants time zone id to convert, but not as JDK
* provided {@link TimeZone}
*
* @since 2.4
*/
public String timeZoneAsString() {
if (_timezone != null) {
return _timezone.getID();
}
return timezoneStr;
}
public TimeZone getTimeZone() {
TimeZone tz = _timezone;
if (tz == null) {
if (timezoneStr == null) {
return null;
}
_timezone = tz = TimeZone.getTimeZone(timezoneStr);
}
return tz;
}
/**
* @since 2.4
*/
public boolean hasShape() { return shape != Shape.ANY; }
/**
* @since 2.4
*/
public boolean hasPattern() {
return (pattern != null) && (pattern.length() > 0);
}
/**
* @since 2.4
*/
public boolean hasLocale() { return locale != null; }
/**
* @since 2.4
*/
public boolean hasTimeZone() {
return (_timezone != null) || (timezoneStr != null && !timezoneStr.isEmpty());
}
}
}
jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonGetter.java 0000664 0000000 0000000 00000002221 12373030577 0031456 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marker annotation that can be used to define a non-static,
* no-argument value-returning (non-void) method to be used as a "getter"
* for a logical property.
* It can be used as an alternative to more general
* {@link JsonProperty} annotation (which is the recommended choice in
* general case).
** Getter means that when serializing Object instance of class that has * this method (possibly inherited from a super class), a call is made * through the method, and return value will be serialized as value of * the property. */ @Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonGetter { /** * Defines name of the logical property this * method is used to access ("get"); empty String means that * name should be derived from the underlying method (using * standard Bean name detection rules) */ String value() default ""; } jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonIdentityInfo.java 0000664 0000000 0000000 00000006547 12373030577 0032650 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation used for indicating that values of annotated type * or property should be serializing so that instances either * contain additional object identifier (in addition actual object * properties), or as a reference that consists of an object id * that refers to a full serialization. In practice this is done * by serializing the first instance as full object and object * identity, and other references to the object as reference values. *
* There are two main approaches to generating object identifier: * either using a generator (either one of standard ones, or a custom * generator), or using a value of a property. The latter case is * indicated by using a placeholder generator marker * {@link ObjectIdGenerators.PropertyGenerator}; former by using explicit generator. * Object id has to be serialized as a property in case of POJOs; * object identity is currently NOT support for JSON Array types * (Java arrays or Lists) or Java Map types. *
* Finally, note that generator type of {@link ObjectIdGenerators.None} * indicates that no Object Id should be included or used: it is included * to allow suppressing Object Ids using mix-in annotations. * * @since 2.0 */ @Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonIdentityInfo { /** * Name of JSON property in which Object Id will reside: also, * if "from property" marker generator is used, identifies * property that will be accessed to get type id. * If a property is used, name must match its external * name (one defined by annotation, or derived from accessor * name as per Java Bean Introspection rules). *
* Default value is @id
.
*/
public String property() default "@id";
/**
* Generator to use for producing Object Identifier for objects:
* either one of pre-defined generators from
* {@link ObjectIdGenerator}, or a custom generator.
* Defined as class to instantiate.
*
* Note that special type * {@link ObjectIdGenerators.None} * can be used to disable inclusion of Object Ids. */ public Class extends ObjectIdGenerator>> generator(); /** * Resolver to use for producing POJO from Object Identifier. *
* Default value is {@link SimpleObjectIdResolver} * * @since 2.4 */ public Class extends ObjectIdResolver> resolver() default SimpleObjectIdResolver.class; /** * Scope is used to define applicability of an Object Id: all ids * must be unique within their scope; where scope is defined * as combination of this value and generator type. * Comparison is simple equivalence, meaning that both type * generator type and scope class must be the same. *
* Scope is used for determining how many generators are needed; * more than one scope is typically only needed if external Object Ids * have overlapping value domains (i.e. are only unique within some * limited scope) */ public Class> scope() default Object.class; } jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonIdentityReference.java 0000664 0000000 0000000 00000002411 12373030577 0033635 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Optional annotation that can be used for customizing details of a reference * to Objects for which "Object Identity" is enabled (see {@link JsonIdentityInfo}). * The main use case is that of enforcing use of Object Id even for the first * time an Object is referenced, instead of first instance being serialized * as full POJO. * * @since 2.1 */ @Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonIdentityReference { /** * Marker to indicate whether all referenced values are to * be serialized as ids (true); or by serializing the * first encountered reference as POJO and only then as id (false). *
* Note that if value of 'true' is used, deserialization may require * additional contextual information, and possibly using a custom * id resolver -- the default handling may not be sufficient. * * @since 2.1 */ public boolean alwaysAsId() default false; } jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonIgnore.java 0000664 0000000 0000000 00000005315 12373030577 0031456 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Marker annotation that indicates that the annotated method or field is to be * ignored by introspection-based * serialization and deserialization functionality. That is, it should * not be consider a "getter", "setter" or "creator". *
* In addition, starting with Jackson 1.9, if this is the only annotation * associated with a property, it will also cause cause the whole * property to be ignored: that is, if setter has this annotation and * getter has no annotations, getter is also effectively ignored. * It is still possible for different accessors to use different * annotations; so if only "getter" is to be ignored, other accessors * (setter or field) would need explicit annotation to prevent * ignoral (usually {@link JsonProperty}). *
* For example, a "getter" method that would otherwise denote * a property (like, say, "getValue" to suggest property "value") * to serialize, would be ignored and no such property would * be output unless another annotation defines alternative method to use. *
* Before version 1.9, this annotation worked purely on method-by-method (or field-by-field) * basis; annotation on one method or field did not imply ignoring other methods * or fields. However, with version 1.9 and above, annotations associated * with various accessors (getter, setter, field, constructor parameter) of * a logical property are combined; meaning that annotations in one (say, setter) * can have effects on all of them (if getter or field has nothing indicating * otherwise). *
* Annotation is usually used just a like a marker annotation, that
* is, without explicitly defining 'value' argument (which defaults
* to true
): but argument can be explicitly defined.
* This can be done to override an existing JsonIgnore by explicitly
* defining one with 'false' argument.
*
* Annotation is similar to {@link javax.xml.bind.annotation.XmlTransient} */ @Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonIgnore { /** * Optional argument that defines whether this annotation is active * or not. The only use for value 'false' if for overriding purposes * (which is not needed often); most likely it is needed for use * with "mix-in annotations" (aka "annotation overrides"). * For most cases, however, default value of "true" is just fine * and should be omitted. */ boolean value() default true; } jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonIgnoreProperties.java 0000664 0000000 0000000 00000003563 12373030577 0033536 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation that can be used to either suppress serialization of * properties (during serialization), or ignore processing of * JSON properties read (during deserialization). *
* Example: *
* // to prevent specified fields from being serialized or deserialized * // (i.e. not include in JSON output; or being set even if they were included) * @JsonIgnoreProperties({ "internalId", "secretKey" }) * // To ignore any unknown properties in JSON input without exception: * @JsonIgnoreProperties(ignoreUnknown=true) **
* Starting with 2.0, this annotation can be applied both to classes and * to properties. If used for both, actual set will be union of all * ignorals: that is, you can only add properties to ignore, not remove * or override. So you can not remove properties to ignore using * per-property annotation. */ @Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonIgnoreProperties { /** * Names of properties to ignore. */ public String[] value() default { }; /** * Property that defines whether it is ok to just ignore any * unrecognized properties during deserialization. * If true, all properties that are unrecognized -- that is, * there are no setters or creators that accept them -- are * ignored without warnings (although handlers for unknown * properties, if any, will still be called) without * exception. *
* Does not have any effect on serialization. */ public boolean ignoreUnknown() default false; } jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonIgnoreType.java 0000664 0000000 0000000 00000002105 12373030577 0032312 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Marker annotation that indicates that all properties of annotated * type are to be ignored during serialization and deserialization. *
* Note: annotation does have boolean 'value' property (which defaults * to 'true'), so that it is actually possible to override value * using mix-in annotations. */ @Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonIgnoreType { /** * Optional argument that defines whether this annotation is active * or not. The only use for value 'false' if for overriding purposes * (which is not needed often); most likely it is needed for use * with "mix-in annotations" ("annotation overrides"). * For most cases, however, default value of "true" is just fine * and should be omitted. */ boolean value() default true; } jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonInclude.java 0000664 0000000 0000000 00000006655 12373030577 0031626 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation used to indicate when value of the annotated property (when * used for a field, method or constructor parameter), or all * properties of the annotated class, is to be serialized. * Without annotation property values are always included, but by using * this annotation one can specify simple exclusion rules to reduce * amount of properties to write out. * * @since 2.0 */ @Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.TYPE, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @com.fasterxml.jackson.annotation.JacksonAnnotation public @interface JsonInclude { /** * Inclusion rule to use. */ public Include value() default Include.ALWAYS; /* /********************************************************** /* Value enumerations needed /********************************************************** */ /** * Enumeration used with {@link JsonInclude} * to define which properties * of Java Beans are to be included in serialization. *
* Note: Jackson 1.x had similarly named ("Inclusion") enumeration included
* in JsonSerialize
annotation: it is not deprecated
* and this value used instead.
*/
public enum Include
{
/**
* Value that indicates that property is to be always included,
* independent of value of the property.
*/
ALWAYS,
/**
* Value that indicates that only properties with non-null
* values are to be included.
*/
NON_NULL,
/**
* Value that indicates that only properties that have values
* that differ from default settings (meaning values they have
* when Bean is constructed with its no-arguments constructor)
* are to be included. Value is generally not useful with
* {@link java.util.Map}s, since they have no default values;
* and if used, works same as {@link #ALWAYS}.
*/
NON_DEFAULT,
/**
* Value that indicates that only properties that have values
* that values that are null or what is considered empty are
* not to be included.
*
* Default emptiness is defined for following type: *
isEmpty()
is called;
* length()
is called,
* and return value of 0 indicates empty String (note that String.isEmpty()
* was added in Java 1.6 and as such can not be used by Jackson
*
* Note that this default handling can be overridden by custom
* JsonSerializer
implementation: if method isEmpty()
* is overridden, it will be called to see if non-null values are
* considered empty (null is always considered empty).
*/
NON_EMPTY
;
}
}
jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonManagedReference.java 0000664 0000000 0000000 00000003433 12373030577 0033405 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation used to indicate that annotated property is part of
* two-way linkage between fields; and that its role is "parent" (or "forward") link.
* Value type (class) of property must have a single compatible property annotated with
* {@link JsonBackReference}. Linkage is handled such that the property
* annotated with this annotation is handled normally (serialized normally, no
* special handling for deserialization); it is the matching back reference
* that requires special handling
*
* All references have logical name to allow handling multiple linkages; typical case * would be that where nodes have both parent/child and sibling linkages. If so, * pairs of references should be named differently. * It is an error for a class too have multiple managed references with same name, * even if types pointed are different. *
* Note: only methods and fields can be annotated with this annotation: constructor * arguments should NOT be annotated, as they can not be either managed or back * references. * * @author tatu */ @Target({ElementType.ANNOTATION_TYPE, ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonManagedReference { /** * Logical have for the reference property pair; used to link managed and * back references. Default name can be used if there is just single * reference pair (for example, node class that just has parent/child linkage, * consisting of one managed reference and matching back reference) */ public String value() default "defaultReference"; } jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonProperty.java 0000664 0000000 0000000 00000006063 12373030577 0032060 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Marker annotation that can be used to define a non-static * method as a "setter" or "getter" for a logical property * (depending on its signature), * or non-static object field to be used (serialized, deserialized) as * a logical property. *
* Default value ("") indicates that the field name is used
* as the property name without any modifications, but it
* can be specified to non-empty value to specify different
* name. Property name refers to name used externally, as
* the field name in JSON objects.
*/
@Target({ElementType.ANNOTATION_TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotation
public @interface JsonProperty
{
/**
* Special value that indicates that handlers should use the default
* name (derived from method or field name) for property.
*
* @since 2.1
*/
public final static String USE_DEFAULT_NAME = "";
/**
* Marker value used to indicate that no index has been specified.
* Used as the default value as annotations do not allow "missing"
* values.
*
* @since 2.4
*/
public final static int INDEX_UNKNOWN = -1;
/**
* Defines name of the logical property, i.e. JSON object field
* name to use for the property. If value is empty String (which is the
* default), will try to use name of the field that is annotated.
* Note that there is
* no default name available for constructor arguments,
* meaning that
* Empty String is not a valid value for constructor arguments.
*/
String value() default USE_DEFAULT_NAME;
/**
* Property that indicates whether a value (which may be explicit
* null) is expected for property during deserialization or not.
* If expected, BeanDeserialized
should indicate
* this as a validity problem (usually by throwing an exception,
* but this may be sent via problem handlers that can try to
* rectify the problem, for example, by supplying a default
* value).
*
* Note that as of 2.0, this property is NOT used by
* BeanDeserializer
: support is expected to be
* added for a later minor version.
*
* @since 2.0
*/
boolean required() default false;
/**
* Property that indicates numerical index of this property (relative
* to other properties specified for the Object). This index
* is typically used by binary formats, but may also be useful
* for schema languages and other tools.
*
* @since 2.4
*/
int index() default INDEX_UNKNOWN;
/* NOTE: considering of adding ability to specify default
* String value -- would work well for scalar types, most of
* which can coerce from Strings. But won't add for 2.0 yet.
*/
//String defaultValue() default "";
}
JsonPropertyDescription.java 0000664 0000000 0000000 00000001444 12373030577 0034203 0 ustar 00root root 0000000 0000000 jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation package com.fasterxml.jackson.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotaion used to define a human readable description for a logical
* property.
* Currently used to populate the description field in generated JSON
* Schemas.
*
* @since 2.3
*/
@Target({ElementType.ANNOTATION_TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotation
public @interface JsonPropertyDescription
{
/**
* Defines a human readable description of the logical property.
* Currently used to populate the description field in generated JSON
* Schemas.
*/
String value() default "";
}
jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonPropertyOrder.java 0000664 0000000 0000000 00000003625 12373030577 0033055 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation that can be used to define ordering (possibly partial) to use
* when serializing object properties. Properties included in annotation
* declaration will be serialized first (in defined order), followed by
* any properties not included in the definition.
* Annotation definition will override any implicit orderings (such as
* guarantee that Creator-properties are serialized before non-creator
* properties)
*
* Examples: *
* // ensure that "id" and "name" are output before other properties **@JsonPropertyOrder({ "id", "name" }) * // order any properties that don't have explicit setting using alphabetic order *@JsonPropertyOrder(alphabetic=true) *
* This annotation may or may not have effect on deserialization: for basic JSON * handling there is no effect, but for other supported data types (or structural * conventions) there may be. *
* NOTE: annotation is allowed for properties, starting with 2.4, mostly to support * alphabetic ordering of {@link java.util.Map} entries. */ @Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonPropertyOrder { /** * Order in which properties of annotated object are to be serialized in. */ public String[] value() default { }; /** * Property that defines what to do regarding ordering of properties * not explicitly included in annotation instance. If set to true, * they will be alphabetically ordered; if false, order is * undefined (default setting) */ public boolean alphabetic() default false; } jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonRawValue.java 0000664 0000000 0000000 00000002325 12373030577 0031757 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Marker annotation that indicates that the annotated method * or field should be serialized by including literal String value * of the property as is, without quoting of characters. * This can be useful for injecting values already serialized in JSON or * passing javascript function definitions from server to a javascript client. *
* Warning: the resulting JSON stream may be invalid depending on your input value. */ @Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonRawValue { /** * Optional argument that defines whether this annotation is active * or not. The only use for value 'false' if for overriding purposes * (which is not needed often); most likely it is needed for use * with "mix-in annotations" (aka "annotation overrides"). * For most cases, however, default value of "true" is just fine * and should be omitted. */ boolean value() default true; } jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonRootName.java 0000664 0000000 0000000 00000003460 12373030577 0031756 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation similar to {@link javax.xml.bind.annotation.XmlRootElement}, * used to indicate name to use for root-level wrapping, if wrapping is * enabled. Annotation itself does not indicate that wrapping should * be used; but if it is, name used for serialization should be name * specified here, and deserializer will expect the name as well. *
* As of 2.4, one missing feature is property "alwaysWrap", which is hoped
* to be added in 2.5, and would be used to force root name wrapping
* for individual types.
*/
@Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@com.fasterxml.jackson.annotation.JacksonAnnotation
public @interface JsonRootName
{
/**
* Root name to use if root-level wrapping is enabled. For data formats
* that use composite names (XML), this is the "local part" of the name
* to use.
*/
public String value();
/**
* Optional namespace to use with data formats that support such
* concept (specifically XML); if so, used with {@link #value} to
* construct fully-qualified name.
*
* @since 2.4
*/
public String namespace() default "";
/*
* Optional marker property that can be defined as true
to force
* wrapping of root element, regardless of whether globally
* "root wrapping" is enabled or not.
*
* Note that value of false
is taken to mean "use defaults",
* and will not block use of wrapper if use is indicated by global features.
*
* @since 2.4
public boolean alwaysWrap() default false;
*/
}
jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonSetter.java 0000664 0000000 0000000 00000002335 12373030577 0031500 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marker annotation that can be used to define a non-static,
* single-argument method to be used as a "setter" for a logical property
* as an alternative to recommended
* {@link JsonProperty} annotation (which was introduced in version 1.1).
*
* Setter means that when a property with matching name is encountered in * JSON content, this method will be used to set value of the property. *
* NOTE: this annotation was briefly deprecated for version 1.5; but has * since been un-deprecated to both allow for asymmetric naming (possibly * different name when reading and writing JSON), and more importantly to * allow multi-argument setter method in future. */ @Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonSetter { /** * Optional default argument that defines logical property this * method is used to modify ("set"); this is the property * name used in JSON content. */ String value() default ""; } jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonSubTypes.java 0000664 0000000 0000000 00000002761 12373030577 0032013 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation used with {@link JsonTypeInfo} to indicate sub types of serializable * polymorphic types, and to associate logical names used within JSON content * (which is more portable than using physical Java class names). */ @Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonSubTypes { /** * Subtypes of the annotated type (annotated class, or property value type * associated with the annotated method). These will be checked recursively * so that types can be defined by only including direct subtypes. */ public Type[] value(); /** * Definition of a subtype, along with optional name. If name is missing, class * of the type will be checked for {@link JsonTypeName} annotation; and if that * is also missing or empty, a default * name will be constructed by type id mechanism. * Default name is usually based on class name. */ public @interface Type { /** * Class of the subtype */ public Class> value(); /** * Logical type name used as the type identifier for the class */ public String name() default ""; } } jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonTypeId.java 0000664 0000000 0000000 00000002720 12373030577 0031426 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Marker annotation that can be used on a property accessor * (field, getter or setter, constructor parameter) to indicate that * the property is to contain type id to use when including * polymorphic type information. * Annotation should only be used if the intent is to override * generation of standard type id: if so, value of the property will be * accessed during serialization and used as the type id. *
* On deserialization annotation has no effect, as visibility of type id * is governed by value of {@link JsonTypeInfo#visible}; properties with * this annotation get no special handling. *
* On serialization, this annotation will exclude property from being * serialized along other properties; instead, its value is serialized * as the type identifier. Since type identifier may be included in * various places, it may still appear like 'normal' property (when using * {@link JsonTypeInfo.As#PROPERTY}), but is more commonly embedded * in a different place, as per inclusion rules (see {@link JsonTypeInfo} * for details). * * @since 2.0 */ @Target({ElementType.ANNOTATION_TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonTypeId { } jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonTypeInfo.java 0000664 0000000 0000000 00000027614 12373030577 0031776 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation; import java.lang.annotation.*; /** * Annotation used for configuring details of if and how type information is * used with JSON serialization and deserialization, to preserve information * about actual class of Object instances. This is necessarily for polymorphic * types, and may also be needed to link abstract declared types and matching * concrete implementation. *
* Some examples of typical annotations: *
* // Include Java class name ("com.myempl.ImplClass") as JSON property "class" * @JsonTypeInfo(use=Id.CLASS, include=As.PROPERTY, property="class") * * // Include logical type name (defined in impl classes) as wrapper; 2 annotations * @JsonTypeInfo(use=Id.NAME, include=As.WRAPPER_OBJECT) * @JsonSubTypes({com.myemp.Impl1.class, com.myempl.Impl2.class}) ** Alternatively you can also define fully customized type handling by using *
@JsonTypeResolver
annotation (from databind package).
** This annotation can be used both for types (classes) and properties. * If both exist, annotation on property has precedence, as it is * considered more specific. *
* When used for properties (fields, methods), this annotation applies * to values: so when applied to structure types * (like {@link java.util.Collection}, {@link java.util.Map}, arrays), * will apply to contained values, not the container; * for non-structured types there is no difference. * This is identical to how JAXB handles type information * annotations; and is chosen since it is the dominant use case. * There is no per-property way to force type information to be included * for type of container (structured type); for container types one has * to use annotation for type declaration. *
* Note on visibility of type identifier: by default, deserialization
* (use during reading of JSON) of type identifier
* is completely handled by Jackson, and is not passed to
* deserializers. However, if so desired,
* it is possible to define property visible = true
* in which case property will be passed as-is to deserializers
* (and set via setter or field) on deserialization.
*
* On serialization side, Jackson will generate type id by itself,
* except if there is a property with name that matches
* {@link #property()}, in which case value of that property is
* used instead.
*/
@Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE,
ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotation
public @interface JsonTypeInfo
{
/*
/**********************************************************
/* Value enumerations used for properties
/**********************************************************
*/
/**
* Definition of different type identifiers that can be included in JSON
* during serialization, and used for deserialization.
*/
public enum Id {
/**
* This means that no explicit type metadata is included, and typing is
* purely done using contextual information possibly augmented with other
* annotations.
*/
NONE(null),
/**
* Means that fully-qualified Java class name is used as the type identifier.
*/
CLASS("@class"),
/**
* Means that Java class name with minimal path is used as the type identifier.
* Minimal means that only the class name, and that part of preceding Java
* package name is included that is needed to construct fully-qualified name
* given fully-qualified name of the declared supertype; additionally a single
* leading dot ('.') must be used to indicate that partial class name is used.
* For example, for supertype "com.foobar.Base", and concrete type
* "com.foo.Impl", only ".Impl" would be included; and for "com.foo.impl.Impl2"
* only ".impl.Impl2" would be included.
* NOTE: leading dot ('.') MUST be used to denote partial (minimal) name;
* if it is missing, value is assumed to be fully-qualified name. Fully-qualified
* name is used in cases where subtypes are not in same package (or sub-package
* thereof) as base class.
*
* If all related classes are in the same Java package, this option can reduce
* amount of type information overhead, especially for small types.
* However, please note that using this alternative is inherently risky since it
* assumes that the
* supertype can be reliably detected. Given that it is based on declared type
* (since ultimate supertype, java.lang.Object
would not be very
* useful reference point), this may not always work as expected.
*/
MINIMAL_CLASS("@c"),
/**
* Means that logical type name is used as type information; name will then need
* to be separately resolved to actual concrete type (Class).
*/
NAME("@type"),
/**
* Means that typing mechanism uses customized handling, with possibly
* custom configuration. This means that semantics of other properties is
* not defined by Jackson package, but by the custom implementation.
*/
CUSTOM(null)
;
private final String _defaultPropertyName;
private Id(String defProp) {
_defaultPropertyName = defProp;
}
public String getDefaultPropertyName() { return _defaultPropertyName; }
}
/**
* Definition of standard type inclusion mechanisms for type metadata.
* Used for standard metadata types, except for {@link Id#NONE}.
* May or may not be used for custom types ({@link Id#CUSTOM}).
*/
public enum As {
/**
* Inclusion mechanism that uses a single configurable property, included
* along with actual data (POJO properties) as a separate meta-property.
*
* Default choice for inclusion. */ PROPERTY, /** * Inclusion mechanism that wraps typed JSON value (POJO * serialized as JSON) in * a JSON Object that has a single entry, * where field name is serialized type identifier, * and value is the actual JSON value. *
* Note: can only be used if type information can be serialized as
* String. This is true for standard type metadata types, but not
* necessarily for custom types.
*/
WRAPPER_OBJECT,
/**
* Inclusion mechanism that wraps typed JSON value (POJO
* serialized as JSON) in
* a 2-element JSON array: first element is the serialized
* type identifier, and second element the serialized POJO
* as JSON Object.
*/
WRAPPER_ARRAY,
/**
* Inclusion mechanism similar to PROPERTY
, except that
* property is included one-level higher in hierarchy, i.e. as sibling
* property at same level as JSON Object to type.
* Note that this choice can only be used for properties, not
* for types (classes). Trying to use it for classes will result in
* inclusion strategy of basic PROPERTY
instead.
*/
EXTERNAL_PROPERTY,
/**
* Inclusion mechanism similar to PROPERTY
with respect
* to deserialization; but one that is produced by a "regular" accessible
* property during serialization. This means that TypeSerializer
* will do nothing, and expect a property with defined name to be output
* using some other mechanism (like default POJO property serialization, or
* custom serializer).
*
* Note that this behavior is quite similar to that of using {@link JsonTypeId};
* except that here TypeSerializer
is basically suppressed;
* whereas with {@link JsonTypeId}, output of regular property is suppressed.
* This mostly matters with respect to output order; this choice is the only
* way to ensure specific placement of type id during serialization.
*
* @since 2.3.0
*/
EXISTING_PROPERTY
;
}
/*
/**********************************************************
/* Annotation properties
/**********************************************************
*/
/**
* Specifies kind of type metadata to use when serializing
* type information for instances of annotated type
* and its subtypes; as well as what is expected during
* deserialization.
*/
public Id use();
/**
* Specifies mechanism to use for including type metadata (if any; for
* {@link Id#NONE} nothing is included); used when serializing,
* and expected when deserializing.
*
* Note that for type metadata type of {@link Id#CUSTOM}, * this setting may or may not have any effect. */ public As include() default As.PROPERTY; /** * Property names used when type inclusion method ({@link As#PROPERTY}) is used * (or possibly when using type metadata of type {@link Id#CUSTOM}). * If POJO itself has a property with same name, value of property * will be set with type id metadata: if no such property exists, type id * is only used for determining actual type. *
* Default property name used if this property is not explicitly defined
* (or is set to empty String
) is based on
* type metadata type ({@link #use}) used.
*/
public String property() default "";
/**
* Optional property that can be used to specify default implementation
* class to use for deserialization if type identifier is either not present,
* or can not be mapped to a registered type (which can occur for ids,
* but not when specifying explicit class to use).
* Property has no effect on serialization.
*
* Note that while this property allows specification of the default * implementation to use, it does not help with structural issues that * may arise if type information is missing. This means that most often * this is used with type-name -based resolution, to cover cases * where new sub-types are added, but base type is not changed to * reference new sub-types. *
* There are certain special values that indicate alternate behavior: *
com.fasterxml.jackson.databind.annotation.NoClass
means that
* objects with unmappable (or missing) type are to be mapped to null references.
* TypeDeserializer
(false).
* Property has no effect on serialization.
*
* Default value is false, meaning that Jackson handles and removes
* the type identifier from JSON content that is passed to
* JsonDeserializer
.
*
* @since 2.0
*/
public boolean visible() default false;
/*
/**********************************************************
/* Helper classes
/**********************************************************
*/
/**
* This marker class that is only to be used with defaultImpl
* annotation property, to indicate that there is no default implementation
* specified.
*
* @deprecated Since 2.4, use {@link java.lang.Void} instead.
*/
@Deprecated
public abstract static class None { }
}
jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonTypeName.java 0000664 0000000 0000000 00000001453 12373030577 0031754 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation used for binding logical name that the annotated class
* has. Used with {@link JsonTypeInfo} (and specifically its
* {@link JsonTypeInfo#use} property) to establish relationship
* between type names and types.
*
* @author tatu
*/
@Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotation
public @interface JsonTypeName {
/**
* Logical type name for annotated type. If missing (or defined as Empty String),
* defaults to using non-qualified class name as the type.
*/
public String value() default "";
}
jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonUnwrapped.java 0000664 0000000 0000000 00000005073 12373030577 0032201 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation used to indicate that a property should be serialized
* "unwrapped"; that is, if it would be serialized as JSON Object, its
* properties are instead included as properties of its containing
* Object. For example, consider case of POJO like:
*
*
* public class Parent { * public int age; * public Name name; * } * public class Name { * public String first, last; * } ** which would normally be serialized as follows (assuming @JsonUnwrapped * had no effect): *
* { * "age" : 18, * "name" : { * "first" : "Joey", * "last" : "Sixpack" * } * } ** can be changed to this: *
* { * "age" : 18, * "first" : "Joey", * "last" : "Sixpack" * } ** by changing Parent class to: *
* public class Parent { * public int age; * @JsonUnwrapped * public Name name; * } ** Annotation can only be added to properties, and not classes, as it is contextual. *
* Also note that annotation only applies if *
BeanSerializer
, not a custom serializer
*
* At most one method of a Class
can be annotated with this annotation;
* if more than one is found, an exception may be thrown.
* Also, if method signature is not compatible with Getters, an exception
* may be thrown (whether exception is thrown or not is an implementation detail (due
* to filtering during introspection, some annotations may be skipped)
* and applications should not rely on specific behavior).
*
* A typical usage is that of annotating toString()
* method so that returned String value is used as the JSON serialization;
* and if deserialization is needed, there is matching constructor
* or factory method annotated with {@link JsonCreator} annotation.
*
* Boolean argument is only used so that sub-classes can "disable" * annotation if necessary. *
* NOTE: when use for Java enum
s, one additional feature is
* that value returned by annotated method is also considered to be the
* value to deserialize from, not just JSON String to serialize as.
* This is possible since set of Enum values is constant and it is possible
* to define mapping, but can not be done in general for POJO types; as such,
* this is not used for POJO deserialization.
*/
@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotation
public @interface JsonValue
{
/**
* Optional argument that defines whether this annotation is active
* or not. The only use for value 'false' if for overriding purposes.
* Overriding may be necessary when used
* with "mix-in annotations" (aka "annotation overrides").
* For most cases, however, default value of "true" is just fine
* and should be omitted.
*/
boolean value() default true;
}
jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/JsonView.java 0000664 0000000 0000000 00000002264 12373030577 0031145 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.fasterxml.jackson.annotation.JacksonAnnotation;
/**
* Annotation used for indicating view(s) that the property
* that is defined by method or field annotated is part of.
*
* An example annotation would be: *
* @JsonView(BasicView.class) ** which would specify that property annotated would be included * when processing (serializing, deserializing) View identified * by
BasicView.class
(or its sub-class).
* If multiple View class identifiers are included, property will
* be part of all of them.
*/
@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotation
public @interface JsonView {
/**
* View or views that annotated element is part of. Views are identified
* by classes, and use expected class inheritance relationship: child
* views contain all elements parent views have, for example.
*/
public Class>[] value() default { };
}
jackson-annotations-2.4.2/src/main/java/com/fasterxml/jackson/annotation/ObjectIdGenerator.java 0000664 0000000 0000000 00000010760 12373030577 0032733 0 ustar 00root root 0000000 0000000 package com.fasterxml.jackson.annotation;
/**
* Definition of API used for constructing Object Identifiers
* (as annotated using {@link JsonIdentityInfo}).
* Also defines factory methods used for creating instances
* for serialization, deserialization.
*
* @param
* Note that actual type of 'context' is
* com.fasterxml.jackson.databind.SerializerProvider
,
* but can not be declared here as type itself (as well as call
* to this object) comes from databind package.
*
* @param context Serialization context object used (of type
* com.fasterxml.jackson.databind.SerializerProvider
;
* may be needed by more complex generators to access contextual
* information such as configuration.
*/
public abstract ObjectIdGenerator