Package com.github.javacliparser
Class AbstractClassOption
- java.lang.Object
-
- com.github.javacliparser.AbstractOption
-
- com.github.javacliparser.AbstractClassOption
-
- All Implemented Interfaces:
Option
,Serializable
- Direct Known Subclasses:
ClassOption
public abstract class AbstractClassOption extends AbstractOption
Abstract class option.- Version:
- $Revision$
- Author:
- Richard Kirkby (rkirkby@cs.waikato.ac.nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Object
currentValue
The current objectprotected String
defaultCLIString
The default command line interface text.static String
FILE_PREFIX_STRING
The prefix text to use to indicate file.static String
INMEM_PREFIX_STRING
The prefix text to use to indicate inmem.protected String
nullString
The null text.protected Class<?>
requiredType
The class type-
Fields inherited from class com.github.javacliparser.AbstractOption
cliChar, illegalNameCharacters, name, purpose
-
-
Constructor Summary
Constructors Constructor Description AbstractClassOption(String name, char cliChar, String purpose, Class<?> requiredType, String defaultCLIString)
Creates a new instance of an abstract option given its class name, command line interface text, its purpose, its class type and its default command line interface text.AbstractClassOption(String name, char cliChar, String purpose, Class<?> requiredType, String defaultCLIString, String nullString)
Creates a new instance of an abstract option given its class name, command line interface text, its purpose, its class type, default command line interface text, and its null text.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static String
classToCLIString(Class<?> aClass, Class<?> requiredType)
Gets the command line interface text of the class.String
getDefaultCLIString()
Gets the Command Line Interface textString
getNullString()
Gets the null string of this option.Class<?>
getRequiredType()
Gets the class type of this option.Object
getValue()
Returns the current object.abstract String
getValueAsCLIString()
Gets the value of a Command Line Interface text as a stringObject
materializeObject()
Gets a materialized object of this option.void
setCurrentObject(Object obj)
Sets current object.abstract void
setValueViaCLIString(String s)
Sets value of this option via the Command Line Interface textstatic String
stripPackagePrefix(String className, Class<?> expectedType)
Gets the class name without its package name prefix.-
Methods inherited from class com.github.javacliparser.AbstractOption
copy, getCLIChar, getName, getPurpose, getStateString, nameIsLegal, resetToDefault
-
-
-
-
Field Detail
-
FILE_PREFIX_STRING
public static final String FILE_PREFIX_STRING
The prefix text to use to indicate file.- See Also:
- Constant Field Values
-
INMEM_PREFIX_STRING
public static final String INMEM_PREFIX_STRING
The prefix text to use to indicate inmem.- See Also:
- Constant Field Values
-
currentValue
protected Object currentValue
The current object
-
requiredType
protected Class<?> requiredType
The class type
-
defaultCLIString
protected String defaultCLIString
The default command line interface text.
-
nullString
protected String nullString
The null text.
-
-
Constructor Detail
-
AbstractClassOption
public AbstractClassOption(String name, char cliChar, String purpose, Class<?> requiredType, String defaultCLIString)
Creates a new instance of an abstract option given its class name, command line interface text, its purpose, its class type and its default command line interface text.- Parameters:
name
- the name of this optioncliChar
- the command line interface textpurpose
- the text describing the purpose of this optionrequiredType
- the class typedefaultCLIString
- the default command line interface text
-
AbstractClassOption
public AbstractClassOption(String name, char cliChar, String purpose, Class<?> requiredType, String defaultCLIString, String nullString)
Creates a new instance of an abstract option given its class name, command line interface text, its purpose, its class type, default command line interface text, and its null text.- Parameters:
name
- the name of this optioncliChar
- the command line interface textpurpose
- the text describing the purpose of this optionrequiredType
- the class typedefaultCLIString
- the default command line interface textnullString
- the null text
-
-
Method Detail
-
setCurrentObject
public void setCurrentObject(Object obj)
Sets current object.- Parameters:
obj
- the object to set as current.
-
getValue
public Object getValue()
Returns the current object.- Returns:
- the current object
-
getRequiredType
public Class<?> getRequiredType()
Gets the class type of this option.- Returns:
- the class type of this option
-
getNullString
public String getNullString()
Gets the null string of this option.- Returns:
- the null string of this option
-
materializeObject
public Object materializeObject()
Gets a materialized object of this option.- Returns:
- the materialized object
-
getDefaultCLIString
public String getDefaultCLIString()
Description copied from interface:Option
Gets the Command Line Interface text- Returns:
- the Command Line Interface text
-
classToCLIString
public static String classToCLIString(Class<?> aClass, Class<?> requiredType)
Gets the command line interface text of the class.- Parameters:
aClass
- the classrequiredType
- the class type- Returns:
- the command line interface text of the class
-
getValueAsCLIString
public abstract String getValueAsCLIString()
Description copied from interface:Option
Gets the value of a Command Line Interface text as a string- Returns:
- the string with the value of the Command Line Interface text
-
setValueViaCLIString
public abstract void setValueViaCLIString(String s)
Description copied from interface:Option
Sets value of this option via the Command Line Interface text- Parameters:
s
- the Command Line Interface text
-
-