Package org.apache.commons.cli
Interface Converter<T,E extends java.lang.Throwable>
-
- Type Parameters:
T
- The return type for the function.E
- The kind of thrown exception or error.
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface Converter<T,E extends java.lang.Throwable>
The definition of the functional interface to call when doing a conversion. LikeFunction<String,T>
but can throw an Exception.- Since:
- 1.7.0
-
-
Field Summary
Fields Modifier and Type Field Description static Converter<java.lang.Class<?>,java.lang.ClassNotFoundException>
CLASS
Class name converter.static Converter<java.util.Date,java.text.ParseException>
DATE
Converts to a date using the format string Form "EEE MMM dd HH:mm:ss zzz yyyy".static Converter<?,java.lang.RuntimeException>
DEFAULT
The default converter.static Converter<java.io.File,java.lang.NullPointerException>
FILE
File name converter.static Converter<java.lang.Number,java.lang.NumberFormatException>
NUMBER
Number converter.static Converter<java.lang.Object,java.lang.ReflectiveOperationException>
OBJECT
Converts a class name to an instance of the class.static Converter<java.nio.file.Path,java.nio.file.InvalidPathException>
PATH
Path converter.static Converter<java.net.URL,java.net.MalformedURLException>
URL
Creates a URL.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
apply(java.lang.String string)
Applies the conversion function to the String argument.
-
-
-
Field Detail
-
DEFAULT
static final Converter<?,java.lang.RuntimeException> DEFAULT
The default converter. Does nothing.
-
CLASS
static final Converter<java.lang.Class<?>,java.lang.ClassNotFoundException> CLASS
Class name converter. CallsClass.forName(String)
.
-
FILE
static final Converter<java.io.File,java.lang.NullPointerException> FILE
File name converter. CallsFile(String)
.
-
PATH
static final Converter<java.nio.file.Path,java.nio.file.InvalidPathException> PATH
Path converter. CallsPaths.get(java.net.URI)
.
-
NUMBER
static final Converter<java.lang.Number,java.lang.NumberFormatException> NUMBER
Number converter. Converts to a Double if a decimal point ('.') is in the string or a Long otherwise.
-
OBJECT
static final Converter<java.lang.Object,java.lang.ReflectiveOperationException> OBJECT
Converts a class name to an instance of the class. Uses the Class converter to find the class and then call the default constructor.- See Also:
CLASS
-
URL
static final Converter<java.net.URL,java.net.MalformedURLException> URL
Creates a URL. CallsURL(String)
.
-
-