public final class ConstructorBasedConverter<T> extends Object implements Converter<T>
Modifier and Type | Method and Description |
---|---|
T |
fromString(String input)
Converts the given input to an object by using the constructor approach.
|
static <T> ConstructorBasedConverter<T> |
getIfEligible(Class<T> clazz)
Checks whether the given class can be used by the
ConstructorBasedConverter (i.e. |
public static <T> ConstructorBasedConverter<T> getIfEligible(Class<T> clazz)
ConstructorBasedConverter
(i.e. has a constructor
taking a single String as argument). If so, creates a new instance of converter for this type.clazz
- the classConstructorBasedConverter
if the given class is eligible,
null otherwise.public T fromString(String input) throws IllegalArgumentException
fromString
in interface Converter<T>
input
- the input, can be nullIllegalArgumentException
- if the instance of T cannot be created from the input.Copyright © 2023 Eclipse. All rights reserved.