[jackson-annotations] 36/207: ...

Timo Aaltonen tjaalton at moszumanska.debian.org
Sat Sep 6 13:55:37 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 fad1e7d9afe01c4f8c9feece3dcd731a7858a402
Author: Tatu Saloranta <tsaloranta at gmail.com>
Date:   Fri Mar 2 21:55:06 2012 -0800

    ...
---
 README.md | 80 ++++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 41 insertions(+), 39 deletions(-)

diff --git a/README.md b/README.md
index d587ed8..2abaaea 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,6 @@ To use annotations, you need to use Maven dependency:
       <version>2.0.0</version>
     </dependency>
 
-
 or download jars from Maven repository or [Download page](wiki.fasterxml.com/JacksonDownload)
 
 ## Usage, simple
@@ -96,45 +95,22 @@ Sometimes the type Jackson uses when reading or writing a property is not quite
 
 These cases can be handled by following annotations:
 
-   public class ValueContainer {
-     // although nominal type is 'Value', we want to read JSON as 'ValueImpl'
-     @JsonDeserialize(as=ValueImpl.class)
-     public Value value;
+    public class ValueContainer {
+      // although nominal type is 'Value', we want to read JSON as 'ValueImpl'
+      @JsonDeserialize(as=ValueImpl.class)
+      public Value value;
 
-     // although runtime type may be 'AdvancedType', we really want to serialize
-     // as 'BasicType'; two ways to do this:
-     @JsonSerialize(as=BasicType.class)
-     // or could also use: @JsonSerialize(typing=Typing.STATIC)
-     public BasicType another;
+      // although runtime type may be 'AdvancedType', we really want to serialize
+      // as 'BasicType'; two ways to do this:
+      @JsonSerialize(as=BasicType.class)
+      // or could also use: @JsonSerialize(typing=Typing.STATIC)
+      public BasicType another;
+    }
 
 -----
 
 ## Usage, intermediate
 
-### Changing property auto-detection
-
-The default Jackson property detection rules will find:
-
-* All ''public'' fields
-* All ''public'' getters ('getXxx()' methods)
-* All setters ('setXxx(value)' methods), ''regardless of visibility'')
-
-But if this does not work, you can change visibility levels by using annotation `@JsonAutoDetect`.
-If you wanted, for example, to auto-detect ALL fields (similar to how packages like GSON work), you could do:
-
-    @JsonAutoDetect(fieldVisiblity=JsonAutoDetect.Visibility.ANY)
-    public class POJOWithFields {
-      private int value;
-    }
-
-or, to disable auto-detection of fields altogether:
-
-    @JsonAutoDetect(fieldVisiblity=JsonAutoDetect.Visibility.NONE)
-    public class POJOWithNoFields {
-      // will NOT be included, unless there is access 'getValue()'
-      public int value;
-    }
-
 ### Using constructors or factory methods
 
 By default, Jackson tries to use the "default" constructor (one that takes no arguments), when creating value instances. But you can also choose to use another constructor, or a static factory method to create instance. To do this, you will need to use annotation `@JsonCreator`, and possibly `@JsonProperty` annotations to bind names to arguments:
@@ -197,13 +173,39 @@ Note that this annotation has lots of configuration possibilities: for more info
 * [JavaDocs](http://wiki.fasterxml.com/JacksonJavaDocs)
 * [Intro to polymorphic type handling](http://www.cowtowncoder.com/blog/archives/2010/03/entry_372.html)
 
+### Changing property auto-detection
+
+The default Jackson property detection rules will find:
+
+* All ''public'' fields
+* All ''public'' getters ('getXxx()' methods)
+* All setters ('setXxx(value)' methods), ''regardless of visibility'')
+
+But if this does not work, you can change visibility levels by using annotation `@JsonAutoDetect`.
+If you wanted, for example, to auto-detect ALL fields (similar to how packages like GSON work), you could do:
+
+    @JsonAutoDetect(fieldVisiblity=JsonAutoDetect.Visibility.ANY)
+    public class POJOWithFields {
+      private int value;
+    }
+
+or, to disable auto-detection of fields altogether:
+
+    @JsonAutoDetect(fieldVisiblity=JsonAutoDetect.Visibility.NONE)
+    public class POJOWithNoFields {
+      // will NOT be included, unless there is access 'getValue()'
+      public int value;
+    }
+
+-----
 
 # Further reading
 
+[Databinding](https://github.com/FasterXML/jackson-databind) module has more documentation, since it is the main user of annotations.
+In addition, here are other useful links:
+
+* [Annotation documentation at FasterXML Wiki](http://wiki.fasterxml.com/JacksonAnnotations)
 * [Jackson Project Home](http://wiki.fasterxml.com/JacksonHome)
- * [General Documentation](http://wiki.fasterxml.com/JacksonDocumentation)
- * [Annotation documentation](http://wiki.fasterxml.com/JacksonAnnotations)
- * [JavaDocs](http://wiki.fasterxml.com/JacksonJavaDocs)
- * [Downloads](http://wiki.fasterxml.com/JacksonDownload)
+* [General Jackson Documentation](http://wiki.fasterxml.com/JacksonDocumentation)
+* [Jackson JavaDocs](http://wiki.fasterxml.com/JacksonJavaDocs)
 
-Check out [Wiki].

-- 
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