[jackson-jaxrs-providers] 22/162: ... refactor
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 af6cb7ef2d702d51df3deca52f88ae273f29c5b5
Author: Tatu Saloranta <tsaloranta at gmail.com>
Date: Sat Mar 16 08:44:18 2013 -0700
... refactor
---
.../jackson/jaxrs/smile/JacksonSmileProvider.java | 5 ++---
...figurator.java => SmileMapperConfigurator.java} | 9 ++++-----
.../jackson/jaxrs/xml/JacksonXMLProvider.java | 22 ++++++++++------------
.../EndpointConfig.java => XMLEndpointConfig.java} | 21 +++++++++++----------
...onfigurator.java => XMLMapperConfigurator.java} | 9 ++++-----
.../jackson/jaxrs/xml/annotation/package-info.java | 5 -----
6 files changed, 31 insertions(+), 40 deletions(-)
diff --git a/smile/src/main/java/com/fasterxml/jackson/jaxrs/smile/JacksonSmileProvider.java b/smile/src/main/java/com/fasterxml/jackson/jaxrs/smile/JacksonSmileProvider.java
index 2c171b7..d25b599 100644
--- a/smile/src/main/java/com/fasterxml/jackson/jaxrs/smile/JacksonSmileProvider.java
+++ b/smile/src/main/java/com/fasterxml/jackson/jaxrs/smile/JacksonSmileProvider.java
@@ -10,7 +10,6 @@ import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.jaxrs.base.ProviderBase;
import com.fasterxml.jackson.jaxrs.smile.annotation.SmileEndpointConfig;
-import com.fasterxml.jackson.jaxrs.smile.cfg.MapperConfigurator;
/**
* Basic implementation of JAX-RS abstractions ({@link MessageBodyReader},
@@ -49,7 +48,7 @@ public class JacksonSmileProvider
extends ProviderBase<JacksonSmileProvider,
ObjectMapper, Annotations,
SmileEndpointConfig,
- MapperConfigurator
+ SmileMapperConfigurator
>
{
/**
@@ -113,7 +112,7 @@ extends ProviderBase<JacksonSmileProvider,
*/
public JacksonSmileProvider(ObjectMapper mapper, Annotations[] annotationsToUse)
{
- super(new MapperConfigurator(mapper, annotationsToUse));
+ super(new SmileMapperConfigurator(mapper, annotationsToUse));
}
/**
diff --git a/smile/src/main/java/com/fasterxml/jackson/jaxrs/smile/cfg/MapperConfigurator.java b/smile/src/main/java/com/fasterxml/jackson/jaxrs/smile/SmileMapperConfigurator.java
similarity index 92%
rename from smile/src/main/java/com/fasterxml/jackson/jaxrs/smile/cfg/MapperConfigurator.java
rename to smile/src/main/java/com/fasterxml/jackson/jaxrs/smile/SmileMapperConfigurator.java
index 352f040..0807876 100644
--- a/smile/src/main/java/com/fasterxml/jackson/jaxrs/smile/cfg/MapperConfigurator.java
+++ b/smile/src/main/java/com/fasterxml/jackson/jaxrs/smile/SmileMapperConfigurator.java
@@ -1,4 +1,4 @@
-package com.fasterxml.jackson.jaxrs.smile.cfg;
+package com.fasterxml.jackson.jaxrs.smile;
import java.util.*;
@@ -9,15 +9,14 @@ import com.fasterxml.jackson.dataformat.smile.SmileFactory;
import com.fasterxml.jackson.jaxrs.base.cfg.MapperConfiguratorBase;
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
-import com.fasterxml.jackson.jaxrs.smile.Annotations;
/**
* Helper class used to encapsulate details of configuring an
* {@link ObjectMapper} instance to be used for data binding, as
* well as accessing it.
*/
-public class MapperConfigurator
- extends MapperConfiguratorBase<MapperConfigurator, ObjectMapper, Annotations>
+public class SmileMapperConfigurator
+ extends MapperConfiguratorBase<SmileMapperConfigurator, ObjectMapper, Annotations>
{
/*
/**********************************************************
@@ -25,7 +24,7 @@ public class MapperConfigurator
/**********************************************************
*/
- public MapperConfigurator(ObjectMapper mapper, Annotations[] defAnnotations)
+ public SmileMapperConfigurator(ObjectMapper mapper, Annotations[] defAnnotations)
{
super(mapper, defAnnotations);
}
diff --git a/xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/JacksonXMLProvider.java b/xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/JacksonXMLProvider.java
index c673b90..6d21a7f 100644
--- a/xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/JacksonXMLProvider.java
+++ b/xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/JacksonXMLProvider.java
@@ -21,8 +21,6 @@ import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.jaxrs.base.util.AnnotationBundleKey;
import com.fasterxml.jackson.jaxrs.base.util.ClassKey;
-import com.fasterxml.jackson.jaxrs.xml.annotation.EndpointConfig;
-import com.fasterxml.jackson.jaxrs.xml.cfg.MapperConfigurator;
/**
* Basic implementation of JAX-RS abstractions ({@link MessageBodyReader},
@@ -131,14 +129,14 @@ public class JacksonXMLProvider
/**
* Cache for resolved endpoint configurations when reading XML
*/
- protected final LRUMap<AnnotationBundleKey, EndpointConfig> _readers
- = new LRUMap<AnnotationBundleKey, EndpointConfig>(16, 120);
+ protected final LRUMap<AnnotationBundleKey, XMLEndpointConfig> _readers
+ = new LRUMap<AnnotationBundleKey, XMLEndpointConfig>(16, 120);
/**
* Cache for resolved endpoint configurations when writing XML
*/
- protected final LRUMap<AnnotationBundleKey, EndpointConfig> _writers
- = new LRUMap<AnnotationBundleKey, EndpointConfig>(16, 120);
+ protected final LRUMap<AnnotationBundleKey, XMLEndpointConfig> _writers
+ = new LRUMap<AnnotationBundleKey, XMLEndpointConfig>(16, 120);
/*
/**********************************************************
@@ -150,7 +148,7 @@ public class JacksonXMLProvider
* Helper object used for encapsulating configuration aspects
* of {@link XmlMapper}
*/
- protected final MapperConfigurator _mapperConfig;
+ protected final XMLMapperConfigurator _mapperConfig;
/**
* Set of types (classes) that provider should ignore for data binding
@@ -232,7 +230,7 @@ public class JacksonXMLProvider
*/
public JacksonXMLProvider(XmlMapper mapper, Annotations[] annotationsToUse)
{
- _mapperConfig = new MapperConfigurator(mapper, annotationsToUse);
+ _mapperConfig = new XMLMapperConfigurator(mapper, annotationsToUse);
}
/**
@@ -400,14 +398,14 @@ public class JacksonXMLProvider
throws IOException
{
AnnotationBundleKey key = new AnnotationBundleKey(annotations);
- EndpointConfig endpoint;
+ XMLEndpointConfig endpoint;
synchronized (_readers) {
endpoint = _readers.get(key);
}
// not yet resolved (or not cached any more)? Resolve!
if (endpoint == null) {
XmlMapper mapper = locateMapper(type, mediaType);
- endpoint = EndpointConfig.forReading(mapper, annotations);
+ endpoint = XMLEndpointConfig.forReading(mapper, annotations);
// and cache for future reuse
synchronized (_readers) {
_readers.put(key.immutableKey(), endpoint);
@@ -480,14 +478,14 @@ public class JacksonXMLProvider
throws IOException
{
AnnotationBundleKey key = new AnnotationBundleKey(annotations);
- EndpointConfig endpoint;
+ XMLEndpointConfig endpoint;
synchronized (_writers) {
endpoint = _writers.get(key);
}
// not yet resolved (or not cached any more)? Resolve!
if (endpoint == null) {
XmlMapper mapper = locateMapper(type, mediaType);
- endpoint = EndpointConfig.forWriting(mapper, annotations);
+ endpoint = XMLEndpointConfig.forWriting(mapper, annotations);
// and cache for future reuse
synchronized (_writers) {
_writers.put(key.immutableKey(), endpoint);
diff --git a/xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/annotation/EndpointConfig.java b/xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/XMLEndpointConfig.java
similarity index 88%
rename from xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/annotation/EndpointConfig.java
rename to xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/XMLEndpointConfig.java
index f5fc3b7..ee23c35 100644
--- a/xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/annotation/EndpointConfig.java
+++ b/xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/XMLEndpointConfig.java
@@ -1,4 +1,4 @@
-package com.fasterxml.jackson.jaxrs.xml.annotation;
+package com.fasterxml.jackson.jaxrs.xml;
import java.lang.annotation.Annotation;
@@ -7,12 +7,13 @@ import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.*;
+import com.fasterxml.jackson.jaxrs.xml.annotation.JacksonFeatures;
/**
* Container class for figuring out annotation-based configuration
* for JAX-RS end points.
*/
-public class EndpointConfig
+public class XMLEndpointConfig
{
// // General configuration
@@ -40,25 +41,25 @@ public class EndpointConfig
/**********************************************************
*/
- protected EndpointConfig() { }
+ protected XMLEndpointConfig() { }
- public static EndpointConfig forReading(ObjectMapper mapper, Annotation[] annotations)
+ public static XMLEndpointConfig forReading(ObjectMapper mapper, Annotation[] annotations)
{
- return new EndpointConfig()
+ return new XMLEndpointConfig()
.add(annotations, false)
.initReader(mapper);
}
- public static EndpointConfig forWriting(ObjectMapper mapper, Annotation[] annotations)
+ public static XMLEndpointConfig forWriting(ObjectMapper mapper, Annotation[] annotations)
{
- EndpointConfig config = new EndpointConfig();
+ XMLEndpointConfig config = new XMLEndpointConfig();
return config
.add(annotations, true)
.initWriter(mapper)
;
}
- protected EndpointConfig add(Annotation[] annotations, boolean forWriting)
+ protected XMLEndpointConfig add(Annotation[] annotations, boolean forWriting)
{
// Same as [issue-10] with JSON provider; must check for null:
if (annotations != null) {
@@ -93,7 +94,7 @@ public class EndpointConfig
return this;
}
- protected EndpointConfig initReader(ObjectMapper mapper)
+ protected XMLEndpointConfig initReader(ObjectMapper mapper)
{
// first common config
if (_activeView != null) {
@@ -120,7 +121,7 @@ public class EndpointConfig
return this;
}
- protected EndpointConfig initWriter(ObjectMapper mapper)
+ protected XMLEndpointConfig initWriter(ObjectMapper mapper)
{
// first common config
if (_activeView != null) {
diff --git a/xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/cfg/MapperConfigurator.java b/xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/XMLMapperConfigurator.java
similarity index 93%
rename from xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/cfg/MapperConfigurator.java
rename to xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/XMLMapperConfigurator.java
index 3b3b05e..3d5dbff 100644
--- a/xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/cfg/MapperConfigurator.java
+++ b/xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/XMLMapperConfigurator.java
@@ -1,4 +1,4 @@
-package com.fasterxml.jackson.jaxrs.xml.cfg;
+package com.fasterxml.jackson.jaxrs.xml;
import java.util.*;
@@ -11,15 +11,14 @@ import com.fasterxml.jackson.dataformat.xml.jaxb.XmlJaxbAnnotationIntrospector;
import com.fasterxml.jackson.jaxrs.base.cfg.MapperConfiguratorBase;
-import com.fasterxml.jackson.jaxrs.xml.Annotations;
/**
* Helper class used to encapsulate details of configuring an
* {@link XmlMapper} instance to be used for data binding, as
* well as accessing it.
*/
-public class MapperConfigurator
- extends MapperConfiguratorBase<MapperConfigurator, XmlMapper, Annotations>
+public class XMLMapperConfigurator
+ extends MapperConfiguratorBase<XMLMapperConfigurator, XmlMapper, Annotations>
{
/*
/**********************************************************
@@ -27,7 +26,7 @@ public class MapperConfigurator
/**********************************************************
*/
- public MapperConfigurator(XmlMapper mapper, Annotations[] defAnnotations)
+ public XMLMapperConfigurator(XmlMapper mapper, Annotations[] defAnnotations)
{
super(mapper, defAnnotations);
}
diff --git a/xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/annotation/package-info.java b/xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/annotation/package-info.java
deleted file mode 100644
index ed19ecd..0000000
--- a/xml/src/main/java/com/fasterxml/jackson/jaxrs/xml/annotation/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * Package that contains utility classes and methods for
- * the JAX-RS XML provider module.
- */
-package com.fasterxml.jackson.jaxrs.xml.annotation;
--
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