org.dllearner.core.options
Class StringConfigOption

java.lang.Object
  extended by org.dllearner.core.options.ConfigOption<String>
      extended by org.dllearner.core.options.StringConfigOption

public class StringConfigOption
extends ConfigOption<String>

A configuration option, which allows values of type String. Optionally a set of allowed strings can be set. By default all strings are allowed.

Author:
Jens Lehmann

Constructor Summary
StringConfigOption(String name, String description)
           
StringConfigOption(String name, String description, String defaultValue)
           
StringConfigOption(String name, String description, String defaultValue, boolean mandatory, boolean requiresInit)
           
 
Method Summary
 boolean checkType(Object object)
          Checks whether the object has the correct type to be used as a value for this option (this method is necessary, because generic information is erased at runtime in Java).
 Set<String> getAllowedValues()
           
 String getAllowedValuesDescription()
           
 String getDefaultValueInJava()
           
 String getValueFormatting(String value)
          Get a formatted value to put into configuration file.
 String getValueTypeAsJavaString()
           
 boolean isValidValue(String value)
          Checks whether the value is valid, e.g. passing 1985 as integer value for an option, which requires values between 0 and 1, is not valid.
 void setAllowedValues(Set<String> allowedValues)
           
 void setAllowedValues(String[] allowedValues)
           
 
Methods inherited from class org.dllearner.core.options.ConfigOption
getDefaultValue, getDescription, getJavaDocString, getJavaImports, getName, isMandatory, requiresInit, setDefaultValue, setMandatory, setRequiresInit, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringConfigOption

public StringConfigOption(String name,
                          String description)

StringConfigOption

public StringConfigOption(String name,
                          String description,
                          String defaultValue)

StringConfigOption

public StringConfigOption(String name,
                          String description,
                          String defaultValue,
                          boolean mandatory,
                          boolean requiresInit)
Method Detail

getDefaultValueInJava

public String getDefaultValueInJava()
Overrides:
getDefaultValueInJava in class ConfigOption<String>
Returns:
the defaultValue

getValueTypeAsJavaString

public String getValueTypeAsJavaString()
Specified by:
getValueTypeAsJavaString in class ConfigOption<String>

isValidValue

public boolean isValidValue(String value)
Description copied from class: ConfigOption
Checks whether the value is valid, e.g. passing 1985 as integer value for an option, which requires values between 0 and 1, is not valid.

Specified by:
isValidValue in class ConfigOption<String>
Parameters:
value - A value for the option.
Returns:
True if the value is valid and false otherwise.

getAllowedValues

public Set<String> getAllowedValues()
Returns:
the allowedValues

getAllowedValuesDescription

public String getAllowedValuesDescription()
Overrides:
getAllowedValuesDescription in class ConfigOption<String>

setAllowedValues

public void setAllowedValues(Set<String> allowedValues)
Parameters:
allowedValues - the allowedValues to set

setAllowedValues

public void setAllowedValues(String[] allowedValues)

checkType

public boolean checkType(Object object)
Description copied from class: ConfigOption
Checks whether the object has the correct type to be used as a value for this option (this method is necessary, because generic information is erased at runtime in Java).

Specified by:
checkType in class ConfigOption<String>
Parameters:
object - The object to check.
Returns:
True of the type is correct, false otherwise.

getValueFormatting

public String getValueFormatting(String value)
Description copied from class: ConfigOption
Get a formatted value to put into configuration file.

Specified by:
getValueFormatting in class ConfigOption<String>
Parameters:
value - Option value.
Returns:
A string to put into a conf file.


SourceForge.net Logo DL-Learner is licenced under the terms of the GNU General Public License.
Copyright © 2007-2011 Jens Lehmann