This is an automated email from the git hooks/post-receive script. tjaalton pushed a commit to branch master in repository jackson-annotations.
commit 214266285489d8c58f603fb5bdd0688306ce4da6 Author: Tatu Saloranta <tsalora...@gmail.com> Date: Fri Feb 10 09:44:28 2012 -0800 minor mod to ObjectIdGenerator, allow passing of context --- .../jackson/annotation/ObjectIdGenerator.java | 20 ++++++++++++++++---- .../jackson/annotation/ObjectIdGenerators.java | 8 ++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/annotation/ObjectIdGenerator.java b/src/main/java/com/fasterxml/jackson/annotation/ObjectIdGenerator.java index 995c522..5fb66a4 100644 --- a/src/main/java/com/fasterxml/jackson/annotation/ObjectIdGenerator.java +++ b/src/main/java/com/fasterxml/jackson/annotation/ObjectIdGenerator.java @@ -21,7 +21,9 @@ public abstract class ObjectIdGenerator<T> /** * Method called to check whether this generator instance can * be used for Object Ids of specific generator type and - * scope. + * scope; determination is based by passing a configured + * "blueprint" (prototype) instance; from which the actual + * instances are created (using {@link #newForSerialization}). * * @return True if this instance can be used as-is; false if not */ @@ -35,16 +37,26 @@ public abstract class ObjectIdGenerator<T> /** * Factory method to create a blueprint instance for specified - * scope. Generator that do not use scope may return 'this'. + * scope. Generators that do not use scope may return 'this'. */ public abstract ObjectIdGenerator<T> forScope(Class<?> scope); /** * Factory method called to create a new instance to use for * serialization: needed since generators may have state - * (next id to produce) + * (next id to produce). + *<p> + * Note that actual type of 'context' is + * <code>com.fasterxml.jackson.databind.SerializerProvider</code>, + * but can not be declared here as type itself (as well as call + * to this object) comes from databind package. + * + * @param config Serialization context object used (of type + * <code>com.fasterxml.jackson.databind.SerializerProvider</code>; + * may be needed by more complex generators to access contextual + * information such as configuration. */ - public abstract ObjectIdGenerator<T> newForSerialization(); + public abstract ObjectIdGenerator<T> newForSerialization(Object context); /** * Method for constructing key to use for ObjectId-to-POJO maps. diff --git a/src/main/java/com/fasterxml/jackson/annotation/ObjectIdGenerators.java b/src/main/java/com/fasterxml/jackson/annotation/ObjectIdGenerators.java index f0ae0eb..3317fba 100644 --- a/src/main/java/com/fasterxml/jackson/annotation/ObjectIdGenerators.java +++ b/src/main/java/com/fasterxml/jackson/annotation/ObjectIdGenerators.java @@ -49,7 +49,7 @@ public class ObjectIdGenerators * that no generator is used; which also implies that no * Object Id is to be included or used. */ - public abstract class None extends ObjectIdGenerator<Object> { } + public abstract static class None extends ObjectIdGenerator<Object> { } /** * Abstract place-holder class which is used to denote case @@ -60,7 +60,7 @@ public class ObjectIdGenerators * Actual implementation class is part of <code>databind</code> * package. */ - public abstract class PropertyGenerator<T> extends Base<T> { + public abstract static class PropertyGenerator extends Base<Object> { protected PropertyGenerator(Class<?> scope) { super(scope); } } @@ -86,7 +86,7 @@ public class ObjectIdGenerators } @Override - public ObjectIdGenerator<Integer> newForSerialization() { + public ObjectIdGenerator<Integer> newForSerialization(Object context) { return new IntSequenceGenerator(_scope, initialValue()); } @@ -131,7 +131,7 @@ public class ObjectIdGenerators * Can just return base instance since this is essentially scopeless */ @Override - public ObjectIdGenerator<UUID> newForSerialization() { + public ObjectIdGenerator<UUID> newForSerialization(Object context) { return this; } -- 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