Author: davidb
Date: Wed Sep 21 10:41:16 2016
New Revision: 1761715

URL: http://svn.apache.org/viewvc?rev=1761715&view=rev
Log:
Felix Converter - add a withContext() API to the (De)Serializing interfaces

Modified:
    
felix/trunk/converter/serializer/src/main/java/org/osgi/service/serializer/Deserializing.java
    
felix/trunk/converter/serializer/src/main/java/org/osgi/service/serializer/Serializing.java

Modified: 
felix/trunk/converter/serializer/src/main/java/org/osgi/service/serializer/Deserializing.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/converter/serializer/src/main/java/org/osgi/service/serializer/Deserializing.java?rev=1761715&r1=1761714&r2=1761715&view=diff
==============================================================================
--- 
felix/trunk/converter/serializer/src/main/java/org/osgi/service/serializer/Deserializing.java
 (original)
+++ 
felix/trunk/converter/serializer/src/main/java/org/osgi/service/serializer/Deserializing.java
 Wed Sep 21 10:41:16 2016
@@ -69,7 +69,19 @@ public interface Deserializing<T> {
      * converter is to be used.
      *
      * @param converter The converter to use.
-     * @return A codec that uses the converter as specified.
+     * @return This Deserializing object to allow further invocations on it.
      */
        Deserializing<T> with(Converter converter);
+
+       /**
+        * Provide contextual information to complete the de-serializing 
operation.
+        * The contexts that can be handled are serializer-specific.
+        *
+        * @param obj The context to use while deserializing.
+     * @return This Deserializing object to allow further invocations on it.
+        */
+       default Deserializing<T> withContext(Object obj) {
+           // Default or simple deserializers do not need additional context
+           return this;
+       }
 }

Modified: 
felix/trunk/converter/serializer/src/main/java/org/osgi/service/serializer/Serializing.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/converter/serializer/src/main/java/org/osgi/service/serializer/Serializing.java?rev=1761715&r1=1761714&r2=1761715&view=diff
==============================================================================
--- 
felix/trunk/converter/serializer/src/main/java/org/osgi/service/serializer/Serializing.java
 (original)
+++ 
felix/trunk/converter/serializer/src/main/java/org/osgi/service/serializer/Serializing.java
 Wed Sep 21 10:41:16 2016
@@ -35,7 +35,7 @@ public interface Serializing {
         * result. If not specified {@code null} values will be included in the
         * result.
         *
-        * @return This Encoding object to allow further invocations on it.
+        * @return This Serializing object to allow further invocations on it.
         */
        Serializing ignoreNull();
 
@@ -44,20 +44,10 @@ public interface Serializing {
         * which may make it easier for humans to read. If not specified, the
         * encoded output should be formatted to be compact, so save space.
         *
-        * @return This Encoding object to allow further invocations on it.
+        * @return This Serializing object to allow further invocations on it.
         */
        Serializing pretty();
 
-    /**
-     * Specify the converter to be used by the code, if an alternative, 
adapted,
-     * converter is to be used.
-     *
-     * @param converter The converter to use.
-     * @return A codec that uses the converter as specified.
-     */
-    Serializing with(Converter converter);
-
-
        /**
         * Use an output stream as the target of the encoding operation. UTF-8 
will
         * be used if applicable, the character set may not apply to binary
@@ -94,4 +84,25 @@ public interface Serializing {
         */
        @Override
        String toString();
+
+       /**
+     * Specify the converter to be used by the code, if an alternative, 
adapted,
+     * converter is to be used.
+     *
+     * @param converter The converter to use.
+     * @return This Serializing object to allow further invocations on it.
+     */
+    Serializing with(Converter converter);
+
+    /**
+     * Provide contextual information to complete the serializing operation.
+     * The contexts that can be handled are serializer-specific.
+     *
+     * @param obj The context to use while serializing.
+     * @return This Serializing object to allow further invocations on it.
+     */
+    default Serializing withContext(Object obj) {
+        // Default or simple serializers do not need additional context
+        return this;
+    }
 }


Reply via email to