Class FromStringBasedConverter<T>
java.lang.Object
io.vertx.core.cli.converters.FromStringBasedConverter<T>
- All Implemented Interfaces:
Converter<T>
This 'default' converter tries to create objects using a static 'from' method taking a single String argument.
This converter is particularly convenient for converters themselves.
- Author:
- Clement Escoffier invalid input: '<'[email protected]>
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionfromString(String input) Converts the given input to an object by using the 'fromString' method.static <T> FromStringBasedConverter<T> getIfEligible(Class<T> clazz) Checks whether the given class can be used by theFromStringBasedConverter(i.e. has a static 'fromString' method taking a single String as argument).
-
Field Details
-
FROM_STRING
- See Also:
-
-
Method Details
-
getIfEligible
Checks whether the given class can be used by theFromStringBasedConverter(i.e. has a static 'fromString' method taking a single String as argument). If so, creates a new instance of converter for this type.- Parameters:
clazz- the class- Returns:
- a
FromStringBasedConverterif the given class is eligible, null otherwise.
-
fromString
Converts the given input to an object by using the 'fromString' method. Notice that the method may receive a null value.- Specified by:
fromStringin interfaceConverter<T>- Parameters:
input- the input, can be null- Returns:
- the instance of T
- Throws:
IllegalArgumentException- if the instance of T cannot be created from the input.
-