Author: davidb
Date: Fri Jul  1 15:15:24 2016
New Revision: 1750962

URL: http://svn.apache.org/viewvc?rev=1750962&view=rev
Log:
Felix Converter Service - bring updated service API in.

Modified:
    
felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/AdapterImpl.java
    
felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/json/JsonCodecImpl.java
    
felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/json/JsonEncodingImpl.java
    
felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/yaml/YamlEncodingImpl.java
    felix/trunk/converter/src/main/java/org/osgi/service/converter/Adapter.java
    felix/trunk/converter/src/main/java/org/osgi/service/converter/Codec.java
    
felix/trunk/converter/src/main/java/org/osgi/service/converter/ConversionException.java
    
felix/trunk/converter/src/main/java/org/osgi/service/converter/Converter.java
    
felix/trunk/converter/src/main/java/org/osgi/service/converter/Converting.java
    felix/trunk/converter/src/main/java/org/osgi/service/converter/Decoding.java
    felix/trunk/converter/src/main/java/org/osgi/service/converter/Encoding.java
    
felix/trunk/converter/src/main/java/org/osgi/service/converter/FunctionThrowsException.java
    felix/trunk/converter/src/main/java/org/osgi/service/converter/Rule.java
    
felix/trunk/converter/src/main/java/org/osgi/service/converter/TypeReference.java
    
felix/trunk/converter/src/main/java/org/osgi/service/converter/package-info.java

Modified: 
felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/AdapterImpl.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/AdapterImpl.java?rev=1750962&r1=1750961&r2=1750962&view=diff
==============================================================================
--- 
felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/AdapterImpl.java
 (original)
+++ 
felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/AdapterImpl.java
 Fri Jul  1 15:15:24 2016
@@ -76,6 +76,12 @@ public class AdapterImpl implements Adap
     }
 
     @Override
+    public <F, T> Adapter rule(FunctionThrowsException<F, T> toFun, 
FunctionThrowsException<T, F> fromFun) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
     public <F, T> Adapter rule(Rule<F, T> rule) {
         // TODO Auto-generated method stub
         return null;

Modified: 
felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/json/JsonCodecImpl.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/json/JsonCodecImpl.java?rev=1750962&r1=1750961&r2=1750962&view=diff
==============================================================================
--- 
felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/json/JsonCodecImpl.java
 (original)
+++ 
felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/json/JsonCodecImpl.java
 Fri Jul  1 15:15:24 2016
@@ -96,6 +96,12 @@ public class JsonCodecImpl implements Co
         }
 
         @Override
+        public Encoding ignoreNull() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        @Override
         public Encoding pretty() {
             // TODO Auto-generated method stub
             return null;

Modified: 
felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/json/JsonEncodingImpl.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/json/JsonEncodingImpl.java?rev=1750962&r1=1750961&r2=1750962&view=diff
==============================================================================
--- 
felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/json/JsonEncodingImpl.java
 (original)
+++ 
felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/json/JsonEncodingImpl.java
 Fri Jul  1 15:15:24 2016
@@ -34,17 +34,15 @@ public class JsonEncodingImpl implements
     private final Converter converter;
     private final Map<String, Object> configuration;
     private final Object object;
+    private final boolean ignoreNull;
 
     JsonEncodingImpl(Converter c, Map<String, Object> cfg, Object obj) {
         converter = c;
         configuration = cfg;
+        ignoreNull = Boolean.TRUE.equals(Boolean.parseBoolean((String) 
configuration.get("ignoreNull")));
         object = obj;
     }
 
-    private boolean ignoreNull() {
-        return Boolean.TRUE.equals(Boolean.parseBoolean((String) 
configuration.get("ignoreNull")));
-    }
-
     @Override
     public void to(OutputStream os, Charset charset) {
         try {
@@ -62,7 +60,7 @@ public class JsonEncodingImpl implements
     @SuppressWarnings("rawtypes")
     private String encode(Object obj) {
         if (obj == null) {
-            return ignoreNull() ? "" : "null";
+            return ignoreNull ? "" : "null";
         }
 
         if (obj instanceof Map) {
@@ -112,7 +110,7 @@ public class JsonEncodingImpl implements
         StringBuilder sb = new StringBuilder("{");
         for (Entry entry : (Set<Entry>) m.entrySet()) {
             if (entry.getKey() == null || entry.getValue() == null)
-                if (ignoreNull())
+                if (ignoreNull)
                     continue;
 
             if (sb.length() > 1)
@@ -128,6 +126,12 @@ public class JsonEncodingImpl implements
     }
 
     @Override
+    public Encoding ignoreNull() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
     public Encoding pretty() {
         // TODO Auto-generated method stub
         return null;
@@ -138,4 +142,10 @@ public class JsonEncodingImpl implements
         // TODO Auto-generated method stub
         return null;
     }
+
+    @Override
+    public void to(OutputStream out) throws IOException {
+        // TODO Auto-generated method stub
+
+    }
 }

Modified: 
felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/yaml/YamlEncodingImpl.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/yaml/YamlEncodingImpl.java?rev=1750962&r1=1750961&r2=1750962&view=diff
==============================================================================
--- 
felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/yaml/YamlEncodingImpl.java
 (original)
+++ 
felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/yaml/YamlEncodingImpl.java
 Fri Jul  1 15:15:24 2016
@@ -49,6 +49,17 @@ public class YamlEncodingImpl implements
     }
 
     @Override
+    public Encoding ignoreNull() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void to(OutputStream out) throws IOException {
+        // TODO Auto-generated method stub
+
+    }
+    @Override
     public void to(OutputStream os, Charset charset) {
         try {
             os.write(encode(object).getBytes(charset));

Modified: 
felix/trunk/converter/src/main/java/org/osgi/service/converter/Adapter.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/converter/src/main/java/org/osgi/service/converter/Adapter.java?rev=1750962&r1=1750961&r2=1750962&view=diff
==============================================================================
--- felix/trunk/converter/src/main/java/org/osgi/service/converter/Adapter.java 
(original)
+++ felix/trunk/converter/src/main/java/org/osgi/service/converter/Adapter.java 
Fri Jul  1 15:15:24 2016
@@ -17,21 +17,27 @@ package org.osgi.service.converter;
 
 import java.lang.reflect.Type;
 
+import org.osgi.annotation.versioning.ProviderType;
+
 /**
- * An {@link Adapter} is used to modify the behaviour of the Converter service,
+ * An {@link Adapter} is used to modify the behavior of the Converter service,
  * which can be useful when some of the conversions should be done different to
  * the Converter Specification.
  *
- * @author $Id:$
+ * @author $Id: 786edd90d2baf62c6a166363bf2c36ee0bf4dd4d $
+ * @ThreadSafe
  */
+@ProviderType
 public interface Adapter extends Converter {
        /**
         * Specify a conversion rule by providing a rule object.
         *
+        * @param <F> the type to convert from.
+        * @param <T> the type to convert to.
         * @param rule The conversion rule.
         * @return The current adapter, can be used to chain invocations.
         */
-    <F, T> Adapter rule(Rule<F, T> rule);
+       <F, T> Adapter rule(Rule<F,T> rule);
 
        /**
         * Specify a rule for the conversion to and from two classes. The rule
@@ -39,9 +45,9 @@ public interface Adapter extends Convert
         * to provide the conversions as lambdas, for example:
         *
         * <pre>
-        *  adapter.rule(String[].class, String.class,
-        *      v -> Stream.of(v).collect(Collectors.joining(",")),
-        *      v -> v.split(","));
+        * adapter.rule(String[].class, String.class,
+        *              v -> Stream.of(v).collect(Collectors.joining(",")),
+        *              v -> v.split(","));
         * </pre>
         *
         * @param <F> the type to convert from.
@@ -52,12 +58,24 @@ public interface Adapter extends Convert
         * @param fromFun the function to perform the reverse conversion.
         * @return The current adapter, can be used to chain invocations.
         */
-    <F, T> Adapter rule(Class<F> fromCls, Class<T> toCls,
-            FunctionThrowsException<F, T> toFun, FunctionThrowsException<T, F> 
fromFun);
+       <F, T> Adapter rule(Class<F> fromCls, Class<T> toCls, 
FunctionThrowsException<F,T> toFun,
+               FunctionThrowsException<T,F> fromFun);
+
+       /**
+        * Specify a rule for the conversion to and from two classes. The rule
+        * specifies the conversion in both directions. This overload makes it 
easy
+        * to provide the conversions as method references.
+        *
+        * @param <F> the type to convert from.
+        * @param <T> the type to convert to.
+        * @param toFun the function to perform the conversion.
+        * @param fromFun the function to perform the reverse conversion.
+        * @return The current adapter, can be used to chain invocations.
+        */
+       <F, T> Adapter rule(FunctionThrowsException<F,T> toFun, 
FunctionThrowsException<T,F> fromFun);
 
-    <F, T> Adapter rule(TypeReference<F> fromRef, TypeReference<T> toRef,
-            FunctionThrowsException<F, T> toFun, FunctionThrowsException<T, F> 
fromFun);
+    <F, T> Adapter rule(TypeReference<F> fromRef, TypeReference<T> toRef, 
FunctionThrowsException<F, T> toFun,
+            FunctionThrowsException<T, F> fromFun);
 
-    <F, T> Adapter rule(Type fromType, Type toType,
-            FunctionThrowsException<F, T> toFun, FunctionThrowsException<T, F> 
fromFun);
+    <F, T> Adapter rule(Type fromType, Type toType, FunctionThrowsException<F, 
T> toFun, FunctionThrowsException<T, F> fromFun);
 }

Modified: 
felix/trunk/converter/src/main/java/org/osgi/service/converter/Codec.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/converter/src/main/java/org/osgi/service/converter/Codec.java?rev=1750962&r1=1750961&r2=1750962&view=diff
==============================================================================
--- felix/trunk/converter/src/main/java/org/osgi/service/converter/Codec.java 
(original)
+++ felix/trunk/converter/src/main/java/org/osgi/service/converter/Codec.java 
Fri Jul  1 15:15:24 2016
@@ -17,6 +17,8 @@ package org.osgi.service.converter;
 
 import java.lang.reflect.Type;
 
+import org.osgi.annotation.versioning.ProviderType;
+
 /**
  * The Codec service can be used to encode a given object in a certain
  * representation, for example JSON, YAML or XML. The Codec service can also
@@ -24,8 +26,10 @@ import java.lang.reflect.Type;
  * encode/decode only a single format. To support multiple encoding formats
  * register multiple services.
  * 
- * @author $Id:$
+ * @author $Id: 66e40c74252c1c5c72db50e784d1efb7ab5863c3 $
+ * @ThreadSafe
  */
+@ProviderType
 public interface Codec {
        /**
         * Start specifying a decode operation.
@@ -35,7 +39,7 @@ public interface Codec {
         * @return A {@link Decoding} object to specify the source for the 
decode
         *         operation.
         */
-    <T> Decoding<T> decode(Class<T> cls);
+       <T> Decoding<T> decode(Class<T> cls);
 
        /**
         * Start specifying a decode operation.
@@ -54,23 +58,23 @@ public interface Codec {
         * @return A {@link Decoding} object to specify the source for the 
decode
         *         operation.
         */
-       Decoding<?> decode(Type type);
+       Decoding< ? > decode(Type type);
 
-    /**
-        * Start specifying an encode opertation.
+       /**
+        * Start specifying an encode operation.
         * 
         * @param obj The object to encode.
         * @return an Encoding object to specify the target for the decode
         *         operation.
         */
-    Encoding encode(Object obj);
+       Encoding encode(Object obj);
 
-    /**
+       /**
         * 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.
         */
-    Codec with(Converter converter);
+       Codec with(Converter converter);
 }

Modified: 
felix/trunk/converter/src/main/java/org/osgi/service/converter/ConversionException.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/converter/src/main/java/org/osgi/service/converter/ConversionException.java?rev=1750962&r1=1750961&r2=1750962&view=diff
==============================================================================
--- 
felix/trunk/converter/src/main/java/org/osgi/service/converter/ConversionException.java
 (original)
+++ 
felix/trunk/converter/src/main/java/org/osgi/service/converter/ConversionException.java
 Fri Jul  1 15:15:24 2016
@@ -16,26 +16,29 @@
 package org.osgi.service.converter;
 
 /**
- * This Runtime Exception is thrown when an object is requested to be 
converted but the conversion
- * cannot be done. For example when the String "test" is to be converted into 
a Long.
+ * This Runtime Exception is thrown when an object is requested to be converted
+ * but the conversion cannot be done. For example when the String "test" is to
+ * be converted into a Long.
  */
 public class ConversionException extends RuntimeException {
-    private static final long serialVersionUID = 1L;
+       private static final long serialVersionUID = 1L;
 
-    /**
-     * Create a Conversion Exception with a message.
-     * @param message The message for this exception.
-     */
-    public ConversionException(String message) {
-        super(message);
-    }
+       /**
+        * Create a Conversion Exception with a message.
+        * 
+        * @param message The message for this exception.
+        */
+       public ConversionException(String message) {
+               super(message);
+       }
 
-    /**
-     * Create a Conversion Exception with a message and a nested cause.
-     * @param message The message for this exception.
-     * @param cause The causing exception.
-     */
-    public ConversionException(String message, Throwable cause) {
-        super(message, cause);
-    }
+       /**
+        * Create a Conversion Exception with a message and a nested cause.
+        * 
+        * @param message The message for this exception.
+        * @param cause The causing exception.
+        */
+       public ConversionException(String message, Throwable cause) {
+               super(message, cause);
+       }
 }

Modified: 
felix/trunk/converter/src/main/java/org/osgi/service/converter/Converter.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/converter/src/main/java/org/osgi/service/converter/Converter.java?rev=1750962&r1=1750961&r2=1750962&view=diff
==============================================================================
--- 
felix/trunk/converter/src/main/java/org/osgi/service/converter/Converter.java 
(original)
+++ 
felix/trunk/converter/src/main/java/org/osgi/service/converter/Converter.java 
Fri Jul  1 15:15:24 2016
@@ -15,13 +15,17 @@
  */
 package org.osgi.service.converter;
 
+import org.osgi.annotation.versioning.ProviderType;
+
 /**
  * The Converter service is used to start a conversion. The service is obtained
  * from the service registry. The conversion is then completed via the
  * Converting interface that has methods to specify the target type.
  * 
- * @author $Id:$
+ * @author $Id: f4fc5fc8137df578658ca9b33146f0f5daa22436 $
+ * @ThreadSafe
  */
+@ProviderType
 public interface Converter {
        /**
         * Start a conversion for the given object.
@@ -29,7 +33,7 @@ public interface Converter {
         * @param obj The object that should be converted.
         * @return A {@link Converting} object to complete the conversion.
         */
-    Converting convert(Object obj);
+       Converting convert(Object obj);
 
        /**
         * Obtain an adapter to this converter. The adapter behaves just like 
the
@@ -38,5 +42,5 @@ public interface Converter {
         * 
         * @return An adapter to this converter.
         */
-    Adapter getAdapter();
+       Adapter getAdapter();
 }

Modified: 
felix/trunk/converter/src/main/java/org/osgi/service/converter/Converting.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/converter/src/main/java/org/osgi/service/converter/Converting.java?rev=1750962&r1=1750961&r2=1750962&view=diff
==============================================================================
--- 
felix/trunk/converter/src/main/java/org/osgi/service/converter/Converting.java 
(original)
+++ 
felix/trunk/converter/src/main/java/org/osgi/service/converter/Converting.java 
Fri Jul  1 15:15:24 2016
@@ -17,29 +17,35 @@ package org.osgi.service.converter;
 
 import java.lang.reflect.Type;
 
+import org.osgi.annotation.versioning.ProviderType;
+
 /**
  * This interface is used to specify the target that an object should be
  * converted to. A {@link Converting} instance can be obtained via the
  * {@link Converter} service by starting a conversion for a specific object.
  *
- * @author $Id:$
+ * @author $Id: eaaf163d42227ed96ccdf70620f33a27c7de6b8f $
+ * @ThreadSafe
  */
+@ProviderType
 public interface Converting {
-    /**
-     * The default value to use when the object cannot be converted or in case 
of conversion
-     * from a {@code null} value.
-     * @param defVal The default value.
-     * @return The current {@code Converting} object so that additional calls 
can be chained.
-     */
-    Converting defaultValue(Object defVal);
+       /**
+        * The default value to use when the object cannot be converted or in 
case
+        * of conversion from a {@code null} value.
+        * 
+        * @param defVal The default value.
+        * @return The current {@code Converting} object so that additional 
calls
+        *         can be chained.
+        */
+       Converting defaultValue(Object defVal);
 
-    /**
+       /**
         * Specify the target object type for the conversion as a class object.
         *
         * @param cls The class to convert to.
         * @return The converted object.
         */
-    <T> T to(Class<T> cls);
+       <T> T to(Class<T> cls);
 
        /**
         * Specify the target object type as a {@link TypeReference}. If the 
target
@@ -48,29 +54,29 @@ public interface Converting {
         * information erased. Example use:
         *
         * <pre>
-        *  List<String> result =
-        *      converter.convert(Arrays.asList(1,2,3)).
-        *          to(new TypeReference&lt;List&lt;String&gt;&gt;() {});
+        * List&lt;String&gt; result = converter.convert(Arrays.asList(1, 2, 3))
+        *              .to(new TypeReference&lt;List&lt;String&gt;&gt;() {});
         * </pre>
         *
         * @param ref A type reference to the object being converted to.
         * @return The converted object.
         */
-     <T> T to(TypeReference<T> ref);
+       <T> T to(TypeReference<T> ref);
 
        /**
         * Specify the target object type as a Java Reflection Type object.
         *
         * @param type A Type object to represent the target type to be 
converted
-        *        to.
+        *            to.
         * @return The converted object.
         */
        Object to(Type type);
 
        /**
         * Same as {@code to(String.class)}.
+        * 
         * @return The converted object.
         */
-    @Override
-    String toString();
+       @Override
+       String toString();
 }

Modified: 
felix/trunk/converter/src/main/java/org/osgi/service/converter/Decoding.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/converter/src/main/java/org/osgi/service/converter/Decoding.java?rev=1750962&r1=1750961&r2=1750962&view=diff
==============================================================================
--- 
felix/trunk/converter/src/main/java/org/osgi/service/converter/Decoding.java 
(original)
+++ 
felix/trunk/converter/src/main/java/org/osgi/service/converter/Decoding.java 
Fri Jul  1 15:15:24 2016
@@ -18,12 +18,16 @@ package org.osgi.service.converter;
 import java.io.InputStream;
 import java.nio.charset.Charset;
 
+import org.osgi.annotation.versioning.ProviderType;
+
 /**
  * Interface to specify the source of the decoding operation
  *
  * @param <T> The target type for the decoding operation.
- * @author $Id:$
+ * @author $Id: 19d4ee85851deff4e067be88c7f93076b3db340b $
+ * @ThreadSafe
  */
+@ProviderType
 public interface Decoding<T> {
        /**
         * Use an input stream as the source of the decoding operation. As 
encoding
@@ -57,5 +61,5 @@ public interface Decoding<T> {
         * @param in The char sequence to use.
         * @return the decoded object.
         */
-    T from(CharSequence in);
+       T from(CharSequence in);
 }

Modified: 
felix/trunk/converter/src/main/java/org/osgi/service/converter/Encoding.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/converter/src/main/java/org/osgi/service/converter/Encoding.java?rev=1750962&r1=1750961&r2=1750962&view=diff
==============================================================================
--- 
felix/trunk/converter/src/main/java/org/osgi/service/converter/Encoding.java 
(original)
+++ 
felix/trunk/converter/src/main/java/org/osgi/service/converter/Encoding.java 
Fri Jul  1 15:15:24 2016
@@ -15,17 +15,30 @@
  */
 package org.osgi.service.converter;
 
+import java.io.IOException;
 import java.io.OutputStream;
 import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
+
+import org.osgi.annotation.versioning.ProviderType;
 
 /**
  * Interface to specify the target of the encoding operation.
  *
- * @author $Id:$
+ * @author $Id: 244b81b5e2276d97ac90d3e157ebaa613b424d05 $
+ * @ThreadSafe
  */
+@ProviderType
 public interface Encoding {
        /**
+        * Specify that keys with a {@code null} value must not appear in the
+        * result. If not specified {@code null} values will be included in the
+        * result.
+        * 
+        * @return This Encoding object to allow further invocations on it.
+        */
+       Encoding ignoreNull();
+
+       /**
         * Specify that the encoded output should be formatted to look 'pretty',
         * which may make it easier for humans to read. If not specified, the
         * encoded output should be formatted to be compact, so save space.
@@ -36,21 +49,23 @@ public interface Encoding {
 
        /**
         * Use an output stream as the target of the encoding operation. UTF-8 
will
-        * be used, if applicable.
+        * be used if applicable, the character set may not apply to binary
+        * encodings.
         *
         * @param out The output stream to use.
+        * @throws IOException If an I/O error occurred.
         */
-    default void to(OutputStream os) {
-        to(os, StandardCharsets.UTF_8);
-    }
+       void to(OutputStream out) throws IOException;
 
        /**
         * Use an output stream as the target of the encoding operation.
         *
         * @param out The output stream to use.
-        * @param charset The character set to use.
+        * @param charset The character set to use, if applicable, the 
character set
+        *            may not apply to binary encodings.
+        * @throws IOException If an I/O error occurred.
         */
-       void to(OutputStream out, Charset charset);
+       void to(OutputStream out, Charset charset) throws IOException;
 
        /**
         * Encode the object and append the result to an appendable.

Modified: 
felix/trunk/converter/src/main/java/org/osgi/service/converter/FunctionThrowsException.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/converter/src/main/java/org/osgi/service/converter/FunctionThrowsException.java?rev=1750962&r1=1750961&r2=1750962&view=diff
==============================================================================
--- 
felix/trunk/converter/src/main/java/org/osgi/service/converter/FunctionThrowsException.java
 (original)
+++ 
felix/trunk/converter/src/main/java/org/osgi/service/converter/FunctionThrowsException.java
 Fri Jul  1 15:15:24 2016
@@ -24,10 +24,11 @@ package org.osgi.service.converter;
 @FunctionalInterface
 public interface FunctionThrowsException<T, R> {
     /**
-     * Applies this function to the argument.
-     * @param t The function argument
-     * @return The function result
-     * @throws Exception An exception can be thrown by the function.
-     */
+        * Applies this function to the argument.
+        *
+        * @param t The function argument
+        * @return The function result
+        * @throws Exception An exception can be thrown by the function.
+        */
     R apply(T t) throws Exception;
 }

Modified: 
felix/trunk/converter/src/main/java/org/osgi/service/converter/Rule.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/converter/src/main/java/org/osgi/service/converter/Rule.java?rev=1750962&r1=1750961&r2=1750962&view=diff
==============================================================================
--- felix/trunk/converter/src/main/java/org/osgi/service/converter/Rule.java 
(original)
+++ felix/trunk/converter/src/main/java/org/osgi/service/converter/Rule.java 
Fri Jul  1 15:15:24 2016
@@ -15,46 +15,45 @@
  */
 package org.osgi.service.converter;
 
-import java.util.function.Function;
-
 /**
  * A rule is a data entity can hold all the information needed to specify a
  * custom conversion for use by an @{link Adapter}.
  *
  * @param <F> The type to convert from.
  * @param <T> The type to convert to.
- * @author $Id:$
+ * @author $Id: 7f624253be48fc23d8a793b38673305dbfd5ff9a $
+ * @Immutable
  */
 public class Rule<F, T> {
-    private final Function<F, T> toFun;
-    private final Function<T, F> fromFun;
+       private final FunctionThrowsException<F,T>      toFun;
+       private final FunctionThrowsException<T,F>      fromFun;
 
        /**
         * Specify the functions to do the conversions in both directions.
-        * 
+        *
         * @param to The function that performs the conversion.
         * @param from The function that performs the reverse conversion.
         */
-    public Rule(Function<F, T> to, Function<T, F> from) {
-        toFun = to;
-        fromFun = from;
-    }
+       public Rule(FunctionThrowsException<F,T> to, 
FunctionThrowsException<T,F> from) {
+               toFun = to;
+               fromFun = from;
+       }
 
        /**
         * Obtain the conversion function.
-        * 
+        *
         * @return The conversion function.
         */
-    public Function<F, T> getToFunction() {
-        return toFun;
-    }
+       public FunctionThrowsException<F,T> getToFunction() {
+               return toFun;
+       }
 
        /**
         * Obtain the reverse conversion function.
-        * 
+        *
         * @return The reverse conversion function.
         */
-    public Function<T, F> getFromFunction() {
-        return fromFun;
-    }
+       public FunctionThrowsException<T,F> getFromFunction() {
+               return fromFun;
+       }
 }

Modified: 
felix/trunk/converter/src/main/java/org/osgi/service/converter/TypeReference.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/converter/src/main/java/org/osgi/service/converter/TypeReference.java?rev=1750962&r1=1750961&r2=1750962&view=diff
==============================================================================
--- 
felix/trunk/converter/src/main/java/org/osgi/service/converter/TypeReference.java
 (original)
+++ 
felix/trunk/converter/src/main/java/org/osgi/service/converter/TypeReference.java
 Fri Jul  1 15:15:24 2016
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 package org.osgi.service.converter;
+
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 
@@ -26,29 +27,28 @@ import java.lang.reflect.Type;
  * this reference up and return it with the getType() call.
  *
  * <pre>
- *  List<String> result =
- *      converter.convert(Arrays.asList(1,2,3)).
- *          to(new TypeReference&lt;List&lt;String&gt;&gt;() {});
+ * List&lt;String&gt; result = converter.convert(Arrays.asList(1, 2, 3))
+ *             .to(new TypeReference&lt;List&lt;String&gt;&gt;() {});
  * </pre>
  *
  * @param <T> The target type for the conversion.
- * @author $Id:$
+ * @author $Id: 8c84f9cc11f7d5b063de7b03664db7a3703f2e8f $
+ * @Immutable
  */
 public class TypeReference<T> {
        /**
-        * A {@link TypeReference} cannot be directly instantiated. To use it 
it has
-        * to be extended, typically as an anonymous inner class.
+        * A {@link TypeReference} cannot be directly instantiated. To use it, 
it
+        * has to be extended, typically as an anonymous inner class.
         */
-       protected TypeReference() {
-       }
+       protected TypeReference() {}
 
-    /**
-     * Return the actual type of this Type Reference
-     *
-     * @return the type of this reference.
-     */
-    public Type getType() {
-        return ((ParameterizedType) getClass().
-            getGenericSuperclass()).getActualTypeArguments()[0];
-    }
-}
\ No newline at end of file
+       /**
+        * Return the actual type of this Type Reference
+        *
+        * @return the type of this reference.
+        */
+       public Type getType() {
+               return ((ParameterizedType) getClass().getGenericSuperclass())
+                               .getActualTypeArguments()[0];
+       }
+}

Modified: 
felix/trunk/converter/src/main/java/org/osgi/service/converter/package-info.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/converter/src/main/java/org/osgi/service/converter/package-info.java?rev=1750962&r1=1750961&r2=1750962&view=diff
==============================================================================
--- 
felix/trunk/converter/src/main/java/org/osgi/service/converter/package-info.java
 (original)
+++ 
felix/trunk/converter/src/main/java/org/osgi/service/converter/package-info.java
 Fri Jul  1 15:15:24 2016
@@ -15,10 +15,24 @@
  */
 
 /**
- * Converter Package.
+ * Converter Package Version 1.0.
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest. This package has two types 
of
+ * users: the consumers that use the API in this package and the providers that
+ * implement the API in this package.
+ * <p>
+ * Example import for consumers using the API in this package:
+ * <p>
+ * {@code  Import-Package: org.osgi.service.converter; version="[1.0,2.0)"}
+ * <p>
+ * Example import for providers implementing the API in this package:
+ * <p>
+ * {@code  Import-Package: org.osgi.service.converter; version="[1.0,1.1)"}
  * 
- * @author $Id:$
+ * @author $Id: 1b82a2a1db1431c5e4398f368662b5b6fb5f8547 $
  */
-@org.osgi.annotation.versioning.Version("1.0")
+@Version("1.0")
 package org.osgi.service.converter;
 
+import org.osgi.annotation.versioning.Version;


Reply via email to