@@ -26,8 +26,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
2626import java .util .Date ;
2727
2828/**
29- * The definition of the functional interface to call when doing a conversion.
30- * Like {@code Function<String,T>} but can throw an Exception.
29+ * The definition of the functional interface to call when doing a conversion. Like {@code Function<String,T>} but can throw an Exception.
3130 *
3231 * @param <T> The return type for the function.
3332 * @param <E> The kind of thrown exception or error.
@@ -58,19 +57,13 @@ public interface Converter<T, E extends Throwable> {
5857 Converter <Path , InvalidPathException > PATH = Paths ::get ;
5958
6059 /**
61- * Number converter. Converts to a Double if a decimal point ('.') is in the
62- * string or a Long otherwise.
60+ * Number converter. Converts to a Double if a decimal point ('.') is in the string or a Long otherwise.
6361 */
64- Converter <Number , NumberFormatException > NUMBER = s -> {
65- if (s .indexOf ('.' ) != -1 ) {
66- return Double .valueOf (s );
67- }
68- return Long .valueOf (s );
69- };
62+ Converter <Number , NumberFormatException > NUMBER = s -> s .indexOf ('.' ) != -1 ? (Number ) Double .valueOf (s ) : (Number ) Long .valueOf (s );
7063
7164 /**
72- * Converts a class name to an instance of the class. Uses the Class converter
73- * to find the class and then call the default constructor.
65+ * Converts a class name to an instance of the class. Uses the Class converter to find the class and then call the default constructor.
66+ *
7467 * @see #CLASS
7568 */
7669 Converter <Object , ReflectiveOperationException > OBJECT = s -> CLASS .apply (s ).getConstructor ().newInstance ();
@@ -87,8 +80,9 @@ public interface Converter<T, E extends Throwable> {
8780
8881 /**
8982 * Applies the conversion function to the String argument.
90- * @param str the String to convert
91- * @return the Object from the conversion.
83+ *
84+ * @param str the String to convert
85+ * @return the Object from the conversion.
9286 * @throws E on error.
9387 */
9488 T apply (String str ) throws E ;
0 commit comments