Class IntegerTypeConverter
- java.lang.Object
-
- org.sosy_lab.common.configuration.converters.IntegerTypeConverter
-
- All Implemented Interfaces:
TypeConverter
public class IntegerTypeConverter extends Object implements TypeConverter
Type converter for options of types Integer/Long annotated withIntegerOption
(not for integer options without this annotation).
-
-
Constructor Summary
Constructors Constructor Description IntegerTypeConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
convert(String optionName, String valueStr, TypeToken<?> pType, Annotation pOption, 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 valueStr, TypeToken<?> pType, Annotation pOption, 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).valueStr
- The string to parse.pType
- The target type.pOption
- 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.
-
-