felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r1760124 - in /felix/trunk/converter/converter/src/main/java/org: apache/felix/converter/impl/AdapterImpl.java osgi/service/converter/Adapter.java osgi/service/converter/Function.java osgi/service/converter/FunctionThrowsException.java
Date Sat, 10 Sep 2016 00:23:39 GMT
Author: davidb
Date: Sat Sep 10 00:23:39 2016
New Revision: 1760124

URL: http://svn.apache.org/viewvc?rev=1760124&view=rev
Log:
Felix Converter - Rename FunctionThrowsException to Function.

Added:
    felix/trunk/converter/converter/src/main/java/org/osgi/service/converter/Function.java
Removed:
    felix/trunk/converter/converter/src/main/java/org/osgi/service/converter/FunctionThrowsException.java
Modified:
    felix/trunk/converter/converter/src/main/java/org/apache/felix/converter/impl/AdapterImpl.java
    felix/trunk/converter/converter/src/main/java/org/osgi/service/converter/Adapter.java

Modified: felix/trunk/converter/converter/src/main/java/org/apache/felix/converter/impl/AdapterImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/converter/converter/src/main/java/org/apache/felix/converter/impl/AdapterImpl.java?rev=1760124&r1=1760123&r2=1760124&view=diff
==============================================================================
--- felix/trunk/converter/converter/src/main/java/org/apache/felix/converter/impl/AdapterImpl.java
(original)
+++ felix/trunk/converter/converter/src/main/java/org/apache/felix/converter/impl/AdapterImpl.java
Sat Sep 10 00:23:39 2016
@@ -33,7 +33,7 @@ import org.osgi.service.converter.Conver
 import org.osgi.service.converter.ConvertFunction;
 import org.osgi.service.converter.Converter;
 import org.osgi.service.converter.Converting;
-import org.osgi.service.converter.FunctionThrowsException;
+import org.osgi.service.converter.Function;
 import org.osgi.service.converter.Rule;
 import org.osgi.service.converter.TypeReference;
 
@@ -61,7 +61,7 @@ public class AdapterImpl implements Adap
     @Override
     @SuppressWarnings("unchecked")
     public <F, T> Adapter rule(Class<F> fromCls, Class<T> toCls,
-            FunctionThrowsException<F, T> toFun, FunctionThrowsException<T, F>
fromFun) {
+            Function<F, T> toFun, Function<T, F> fromFun) {
         if (fromCls.equals(toCls))
             throw new IllegalArgumentException();
 
@@ -79,14 +79,14 @@ public class AdapterImpl implements Adap
 
     @Override
     public <F, T> Adapter rule(TypeReference<F> fromRef, TypeReference<T>
toRef,
-            FunctionThrowsException<F, T> toFun, FunctionThrowsException<T, F>
fromFun) {
+            Function<F, T> toFun, Function<T, F> fromFun) {
         // TODO Auto-generated method stub
         return null;
     }
 
     @Override
     public <F, T> Adapter rule(Type fromType, Type toType,
-            FunctionThrowsException<F, T> toFun, FunctionThrowsException<T, F>
fromFun) {
+            Function<F, T> toFun, Function<T, F> fromFun) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -236,9 +236,9 @@ public class AdapterImpl implements Adap
     }
 
     static class ConvertFunctionImpl<F, T> implements ConvertFunction<F, T> {
-        private final FunctionThrowsException<F, T> function;
+        private final Function<F, T> function;
 
-        public ConvertFunctionImpl(FunctionThrowsException<F, T> function) {
+        public ConvertFunctionImpl(Function<F, T> function) {
             this.function = function;
         }
 

Modified: felix/trunk/converter/converter/src/main/java/org/osgi/service/converter/Adapter.java
URL: http://svn.apache.org/viewvc/felix/trunk/converter/converter/src/main/java/org/osgi/service/converter/Adapter.java?rev=1760124&r1=1760123&r2=1760124&view=diff
==============================================================================
--- felix/trunk/converter/converter/src/main/java/org/osgi/service/converter/Adapter.java
(original)
+++ felix/trunk/converter/converter/src/main/java/org/osgi/service/converter/Adapter.java
Sat Sep 10 00:23:39 2016
@@ -59,14 +59,14 @@ public interface Adapter extends Convert
 	 * @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);
+	        Function<F,T> toFun,
+	        Function<T,F> fromFun);
 
 	<F, T> Adapter rule(TypeReference<F> fromRef, TypeReference<T> toRef,
-	        FunctionThrowsException<F,T> toFun,
-	        FunctionThrowsException<T,F> fromFun);
+	        Function<F,T> toFun,
+	        Function<T,F> fromFun);
 
 	<F, T> Adapter rule(Type fromType, Type toType,
-	        FunctionThrowsException<F,T> toFun,
-	        FunctionThrowsException<T,F> fromFun);
+	        Function<F,T> toFun,
+	        Function<T,F> fromFun);
 }

Added: felix/trunk/converter/converter/src/main/java/org/osgi/service/converter/Function.java
URL: http://svn.apache.org/viewvc/felix/trunk/converter/converter/src/main/java/org/osgi/service/converter/Function.java?rev=1760124&view=auto
==============================================================================
--- felix/trunk/converter/converter/src/main/java/org/osgi/service/converter/Function.java
(added)
+++ felix/trunk/converter/converter/src/main/java/org/osgi/service/converter/Function.java
Sat Sep 10 00:23:39 2016
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) OSGi Alliance (2014, 2016). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.converter;
+
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * A function that accepts a single argument and produces a result.
+ *
+ * <p>
+ * This is a functional interface and can be used as the assignment target for a
+ * lambda expression or method reference.
+ *
+ * @param <T> The type of the function input.
+ * @param <R> The type of the function output.
+ *
+ * @ThreadSafe
+ * @author $Id: 3d17c97c7dc36185681b98caed5ee10bdeb2cd93 $
+ */
+@ConsumerType
+@FunctionalInterface
+public interface Function<T, R> {
+    /**
+     * Applies this function to the specified argument.
+     *
+     * @param t The input to this function.
+     * @return The output of this function.
+     * @throws Exception An exception thrown by the method.
+     */
+    R apply(T t) throws Exception;
+}



Mime
View raw message