Package moa.options

Class AbstractClassOption

    • 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 option
        cliChar - the command line interface text
        purpose - the text describing the purpose of this option
        requiredType - the class type
        defaultCLIString - 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 option
        cliChar - the command line interface text
        purpose - the text describing the purpose of this option
        requiredType - the class type
        defaultCLIString - the default command line interface text
        nullString - the null text
    • Method Detail

      • setCurrentObject

        public void setCurrentObject​(Object obj)
        Sets current object.
        Parameters:
        obj - the object to set as current.
      • getPreMaterializedObject

        public Object getPreMaterializedObject()
        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​(TaskMonitor monitor,
                                        ObjectRepository repository)
        Gets a materialized object of this option.
        Parameters:
        monitor - the task monitor to use
        repository - the object repository to use
        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 class
        requiredType - 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
      • stripPackagePrefix

        public static String stripPackagePrefix​(String className,
                                                Class<?> expectedType)
        Gets the class name without its package name prefix.
        Parameters:
        className - the name of the class
        expectedType - the type of the class
        Returns:
        the class name without its package name prefix