This is an automated email from the git hooks/post-receive script. tjaalton pushed a commit to branch master in repository jackson-annotations.
commit cd6848600bd3db6148186e3f2ca59b95416209e9 Author: Tatu Saloranta <[email protected]> Date: Fri Dec 23 08:54:35 2011 -0800 Move a few annotations from databind to here; ones that have no external dependencies --- .../jackson/annotation/JacksonInject.java | 28 ++++++++++++++++++ .../fasterxml/jackson/annotation/JsonFilter.java | 27 +++++++++++++++++ .../fasterxml/jackson/annotation/JsonRootName.java | 25 ++++++++++++++++ .../com/fasterxml/jackson/annotation/JsonView.java | 34 ++++++++++++++++++++++ 4 files changed, 114 insertions(+) diff --git a/src/main/java/com/fasterxml/jackson/annotation/JacksonInject.java b/src/main/java/com/fasterxml/jackson/annotation/JacksonInject.java new file mode 100644 index 0000000..74663d8 --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/annotation/JacksonInject.java @@ -0,0 +1,28 @@ +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; + +/** + * Jackson-specific annotation used for indicating that value of + * annotated property will be "injected", i.e. set based on value + * configured by <code>ObjectMapper</code> (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.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 ""; +} diff --git a/src/main/java/com/fasterxml/jackson/annotation/JsonFilter.java b/src/main/java/com/fasterxml/jackson/annotation/JsonFilter.java new file mode 100644 index 0000000..29ac851 --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/annotation/JsonFilter.java @@ -0,0 +1,27 @@ +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 which logical filter is to be used + * for filtering out properties of type (class) annotated; + * association made by this annotation declaring ids of filters, + * and {@link com.fasterxml.jackson.databind.ObjectMapper} (or objects + * it delegates to) providing matching filters by id. + * Filters to use are of type + * {@link com.fasterxml.jackson.databind.ser.BeanPropertyFilter} and + * are registered through {@link com.fasterxml.jackson.databind.ObjectMapper} + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) [email protected] +public @interface JsonFilter +{ + /** + * Id of filter to use; if empty String (""), no filter is to be used. + */ + public String value(); +} diff --git a/src/main/java/com/fasterxml/jackson/annotation/JsonRootName.java b/src/main/java/com/fasterxml/jackson/annotation/JsonRootName.java new file mode 100644 index 0000000..08c1d93 --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/annotation/JsonRootName.java @@ -0,0 +1,25 @@ +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. + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) [email protected] +public @interface JsonRootName +{ + /** + * Root name to use if root-level wrapping is enabled. + */ + public String value(); + +} diff --git a/src/main/java/com/fasterxml/jackson/annotation/JsonView.java b/src/main/java/com/fasterxml/jackson/annotation/JsonView.java new file mode 100644 index 0000000..8d72a2e --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/annotation/JsonView.java @@ -0,0 +1,34 @@ +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. + *<p> + * An example annotation would be: + *<pre> + * \@JsonView(BasicView.class) + *</pre> + * which would specify that property annotated would be included + * when processing (serializing, deserializing) View identified + * by <code>BasicView.class</code> (or its sub-class). + * If multiple View class identifiers are included, property will + * be part of all of them. + */ +@Target({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 { }; +} -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jackson-annotations.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

