[jackson-annotations] 15/207: Add @JsonObjectId annotation

Timo Aaltonen tjaalton at moszumanska.debian.org
Sat Sep 6 13:55:34 UTC 2014


This is an automated email from the git hooks/post-receive script.

tjaalton pushed a commit to branch master
in repository jackson-annotations.

commit 36ddcea336f6615410c40b29548b667092797314
Author: Tatu Saloranta <tsaloranta at gmail.com>
Date:   Sat Feb 4 19:20:46 2012 -0800

    Add @JsonObjectId annotation
---
 .../fasterxml/jackson/annotation/JsonObjectId.java | 26 ++++++++++++++++++++++
 .../fasterxml/jackson/annotation/JsonTypeId.java   |  2 ++
 2 files changed, 28 insertions(+)

diff --git a/src/main/java/com/fasterxml/jackson/annotation/JsonObjectId.java b/src/main/java/com/fasterxml/jackson/annotation/JsonObjectId.java
new file mode 100644
index 0000000..194eba2
--- /dev/null
+++ b/src/main/java/com/fasterxml/jackson/annotation/JsonObjectId.java
@@ -0,0 +1,26 @@
+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 value accessor
+ * (field, getter) to indicate that
+ * the property will be used to find id value that indicates identity
+ * of the object, for purposes of handling object references (needed
+ * to handled cyclic dependencies, or avoid value duplications).
+ * Any objects should only have at most one accessor defined as
+ * id property; using it for multiple may result in an exception
+ * (behavior is unspecified).
+ * 
+ * @since 2.0
+ */
+ at Target({ElementType.ANNOTATION_TYPE, ElementType.FIELD, ElementType.METHOD})
+ at Retention(RetentionPolicy.RUNTIME)
+ at JacksonAnnotation
+public @interface JsonObjectId
+{
+
+}
diff --git a/src/main/java/com/fasterxml/jackson/annotation/JsonTypeId.java b/src/main/java/com/fasterxml/jackson/annotation/JsonTypeId.java
index aa12869..4a875a2 100644
--- a/src/main/java/com/fasterxml/jackson/annotation/JsonTypeId.java
+++ b/src/main/java/com/fasterxml/jackson/annotation/JsonTypeId.java
@@ -25,6 +25,8 @@ import java.lang.annotation.Target;
  * {@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)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jackson-annotations.git



More information about the pkg-java-commits mailing list