[jackson-jaxrs-providers] 28/162: Implemented #1, allowing JsonParser as input to bind to
Timo Aaltonen
tjaalton at moszumanska.debian.org
Mon Sep 8 22:16:24 UTC 2014
This is an automated email from the git hooks/post-receive script.
tjaalton pushed a commit to branch master
in repository jackson-jaxrs-providers.
commit 8dc0de79587816a462bae44ac0b6e3ef805f07e3
Author: Tatu Saloranta <tsaloranta at gmail.com>
Date: Sat Mar 16 21:38:44 2013 -0700
Implemented #1, allowing JsonParser as input to bind to
---
.../fasterxml/jackson/jaxrs/base/ProviderBase.java | 30 +++++++++++++++++++---
release-notes/VERSION | 1 +
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/base/src/main/java/com/fasterxml/jackson/jaxrs/base/ProviderBase.java b/base/src/main/java/com/fasterxml/jackson/jaxrs/base/ProviderBase.java
index 46361c5..221d168 100644
--- a/base/src/main/java/com/fasterxml/jackson/jaxrs/base/ProviderBase.java
+++ b/base/src/main/java/com/fasterxml/jackson/jaxrs/base/ProviderBase.java
@@ -432,6 +432,7 @@ public abstract class ProviderBase<
}
}
}
+
// Most of the configuration now handled through EndpointConfig, ObjectWriter
// but we may need to force root type:
if (rootType != null) {
@@ -494,6 +495,9 @@ public abstract class ProviderBase<
}
// Finally: if we really want to verify that we can serialize, we'll check:
if (_cfgCheckCanSerialize) {
+ if (_isSpecialReadable(type)) {
+ return true;
+ }
ObjectMapper mapper = locateMapper(type, mediaType);
if (!mapper.canDeserialize(mapper.constructType(type))) {
return false;
@@ -529,6 +533,10 @@ public abstract class ProviderBase<
if (jp == null || jp.nextToken() == null) {
return null;
}
+ // [Issue#1]: allow 'binding' to JsonParser
+ if (((Class<?>) type) == JsonParser.class) {
+ return jp;
+ }
return reader.withType(genericType).readValue(jp);
}
@@ -543,13 +551,13 @@ public abstract class ProviderBase<
{
return reader.getFactory().createParser(rawStream);
}
-
+
/*
/**********************************************************
- /* Private/sub-class helper methods
+ /* Overridable helper methods
/**********************************************************
*/
-
+
/**
* Method called to locate {@link ObjectMapper} to use for serialization
* and deserialization. If an instance has been explicitly defined by
@@ -585,6 +593,22 @@ public abstract class ProviderBase<
return m;
}
+ /**
+ * Overridable helper method used to allow handling of somewhat special
+ * types for reading
+ *
+ * @since 2.2
+ */
+ protected boolean _isSpecialReadable(Class<?> type) {
+ return JsonParser.class == type;
+ }
+
+ /*
+ /**********************************************************
+ /* Private/sub-class helper methods
+ /**********************************************************
+ */
+
protected static boolean _containedIn(Class<?> mainType, HashSet<ClassKey> set)
{
if (set != null) {
diff --git a/release-notes/VERSION b/release-notes/VERSION
index 74870f7..a3cc142 100644
--- a/release-notes/VERSION
+++ b/release-notes/VERSION
@@ -9,6 +9,7 @@ First multi-module release, to make release easier, share some boilerplate code.
Changes:
+#1: Allow binding input to `JsonParser`
#5: Add 'provider.removeUntouchable()'
* Add Woodstox dependency (not just in 'test' scope) to try to avoid problems
with users relying on SJSXP (such as 'extra' xmlns declarations)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jackson-jaxrs-providers.git
More information about the pkg-java-commits
mailing list