This is an automated email from the git hooks/post-receive script. tjaalton pushed a commit to branch master in repository jackson-annotations.
commit 64c14d5dbf2e63f18d730af0dd174d342e770c15 Author: Tatu Saloranta <tsalora...@gmail.com> Date: Tue Feb 21 21:03:57 2012 -0800 Add @JsonFormat details --- .../fasterxml/jackson/annotation/JsonFormat.java | 37 ++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/annotation/JsonFormat.java b/src/main/java/com/fasterxml/jackson/annotation/JsonFormat.java index 8f78fa0..e5da780 100644 --- a/src/main/java/com/fasterxml/jackson/annotation/JsonFormat.java +++ b/src/main/java/com/fasterxml/jackson/annotation/JsonFormat.java @@ -17,6 +17,13 @@ import java.lang.annotation.Target; * 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. + *<p> + * As of Jackson 2.0, known special handling include: + *<ul> + * <li>{@link java.util.Date}: Shape can be {@link Shape#STRING} or {@link Shape#NUMBER}; + * pattern may contain {@link java.text.SimpleDateFormat}-compatible pattern definition. + * </li> + *</ul> * * @since 2.0 */ @@ -25,7 +32,6 @@ import java.lang.annotation.Target; @JacksonAnnotation public @interface JsonFormat { - /** * Datatype-specific additional piece of configuration that may be used * to further refine formatting aspects. This may, for example, determine @@ -38,7 +44,7 @@ public @interface JsonFormat /* /********************************************************** - /* Value enumeration(s) needed + /* Value enumeration(s), value class(es) /********************************************************** */ @@ -100,5 +106,32 @@ public @interface JsonFormat */ 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 + { + public final String pattern; + public final Shape shape; + + public Value(JsonFormat annotationInstance) { + this(annotationInstance.pattern(), annotationInstance.shape()); + } + + public Value(String p, Shape sh) { + pattern = p; + shape = sh; + } } } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jackson-annotations.git _______________________________________________ pkg-java-commits mailing list pkg-java-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits