Class ClassTypeConverter
- java.lang.Object
-
- org.sosy_lab.common.configuration.converters.ClassTypeConverter
-
- All Implemented Interfaces:
TypeConverter
public class ClassTypeConverter extends Object implements TypeConverter
-
-
Constructor Summary
Constructors Constructor Description ClassTypeConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
convert(String optionName, String value, TypeToken<?> type, Annotation secondaryOption, Path pSource, LogManager logger)
Convert a String given by the user to an instance of a given type.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.sosy_lab.common.configuration.converters.TypeConverter
convertDefaultValue, convertDefaultValueFromOtherInstance, getInstanceForNewConfiguration
-
-
-
-
Method Detail
-
convert
public Object convert(String optionName, String value, TypeToken<?> type, Annotation secondaryOption, Path pSource, LogManager logger) throws InvalidConfigurationException
Description copied from interface:TypeConverter
Convert a String given by the user to an instance of a given type.Although the signature of this method does not enforce it, the class of the returned value needs to be assignable to "type" as defined by
TypeToken.isSupertypeOf(java.lang.reflect.Type)
.Before this method is called, the caller ensures that all requirements for the option defined with the
Option
annotation are met.- Specified by:
convert
in interfaceTypeConverter
- Parameters:
optionName
- The name of the option (should only be used for nice error messages).value
- The string to parse.type
- The target type.secondaryOption
- An optional second annotation for the option (this is one of the annotations marked withOptionDetailAnnotation
).pSource
- The file where the configuration option was read from. May contain a dummy value or null if the option was given somehow else.logger
- A logger for warnings etc.- Returns:
- An instance of the target type produced from the string representation-
- Throws:
InvalidConfigurationException
- If the user specified an invalid value.
-
-