Package adams.core.option
Class ClassOption
- java.lang.Object
-
- adams.core.option.AbstractOption
-
- adams.core.option.AbstractArgumentOption
-
- adams.core.option.ClassOption
-
- All Implemented Interfaces:
CleanUpHandler,VariableChangeListener,Serializable
public class ClassOption extends AbstractArgumentOption
Option class for OptionHandler options.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class adams.core.option.AbstractArgumentOption
m_BaseClass, m_Multiple, m_Variable, m_VariableModified, m_VariableReferencesObject
-
Fields inherited from class adams.core.option.AbstractOption
m_Commandline, m_Constraint, m_Debug, m_DefaultValue, m_MinUserMode, m_OutputDefaultValue, m_Owner, m_Property, TOOLTIP_SUFFIX
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedClassOption(OptionManager owner, String commandline, String property, Object defValue)Initializes the option.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddArgumentInfo(StringBuilder buffer)Adds additional information about the argument, e.g., the class.voidcleanUp()Cleans up data structures, frees up memory.protected booleancompareValues(Object value, Object defValue)Skips the test, as it would be too expensive.protected voidsetNestedValues(ArrayList values)Sets the values obtained from the nested structure.StringtoString()Returns the commandline option and the property as string.StringtoString(Object obj)Returns a string representation of the specified object.ObjectvalueOf(String s)Turns the string into the appropriate object.-
Methods inherited from class adams.core.option.AbstractArgumentOption
getBaseClass, getVariable, getVariableName, hasBaseClass, isDefaultValue, isDefaultValue, isMultiple, isVariableAttached, isVariableModified, isVariableReferencingObject, setVariable, toArray, updateVariable, updateVariable, updateVariable, variableChanged
-
Methods inherited from class adams.core.option.AbstractOption
dontOutputDefaultValue, getCommandline, getConstraint, getCurrentValue, getDebug, getDefaultValue, getDescriptor, getMinUserMode, getOptionHandler, getOutputDefaultValue, getOwner, getProperty, getReadMethod, getToolTipMethod, getWriteMethod, hasConstraint, isValid, noConstraint, setConstraint, setCurrentValue, setMinUserMode, setOutputDefaultValue
-
-
-
-
Constructor Detail
-
ClassOption
protected ClassOption(OptionManager owner, String commandline, String property, Object defValue)
Initializes the option. Will always output the default value.- Parameters:
owner- the owner of this optioncommandline- the commandline string to identify the optionproperty- the name of bean propertydefValue- the default value, if null then the owner's current state is used
-
-
Method Detail
-
compareValues
protected boolean compareValues(Object value, Object defValue)
Skips the test, as it would be too expensive.- Specified by:
compareValuesin classAbstractArgumentOption- Parameters:
value- the value to compare against the default valuedefValue- the default value to compare against- Returns:
- always false
-
valueOf
public Object valueOf(String s) throws Exception
Turns the string into the appropriate object.- Specified by:
valueOfin classAbstractArgumentOption- Parameters:
s- the string to parse- Returns:
- the generated object
- Throws:
Exception- if parsing of string fails
-
toString
public String toString(Object obj)
Returns a string representation of the specified object.- Specified by:
toStringin classAbstractArgumentOption- Parameters:
obj- the object to turn into a string- Returns:
- the string representation
-
setNestedValues
protected void setNestedValues(ArrayList values)
Sets the values obtained from the nested structure.- Parameters:
values- the values to set
-
addArgumentInfo
protected void addArgumentInfo(StringBuilder buffer)
Adds additional information about the argument, e.g., the class.- Parameters:
buffer- the buffer to add the information to
-
toString
public String toString()
Returns the commandline option and the property as string.- Overrides:
toStringin classAbstractArgumentOption- Returns:
- the commandline option and property
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUpin interfaceCleanUpHandler- Overrides:
cleanUpin classAbstractArgumentOption
-
-