Class EnumOption

    • Field Detail

      • m_CustomDisplayInstance

        protected EnumWithCustomDisplay m_CustomDisplayInstance
        an instance of an enum with a custom display, used for parsing.
    • Constructor Detail

      • EnumOption

        protected EnumOption​(OptionManager owner,
                             String commandline,
                             String property,
                             Object defValue,
                             UserMode minUserMode)
        Initializes the option. Will always output the default value.
        Parameters:
        owner - the owner of this option
        commandline - the commandline string to identify the option
        property - the name of bean property
        defValue - the default value, if null then the owner's current state is used
        minUserMode - the minimum user mode before showing this option
      • EnumOption

        protected EnumOption​(OptionManager owner,
                             String commandline,
                             String property,
                             Object defValue,
                             boolean outputDefValue,
                             UserMode minUserMode)
        Initializes the option.
        Parameters:
        owner - the owner of this option
        commandline - the commandline string to identify the option
        property - the name of bean property
        defValue - the default value, if null then the owner's current state is used
        outputDefValue - whether to output the default value or not
        minUserMode - the minimum user mode before showing this option
    • Method Detail

      • compareValues

        protected boolean compareValues​(Object value,
                                        Object defValue)
        Compares the two values.
        Specified by:
        compareValues in class AbstractArgumentOption
        Parameters:
        value - the value to compare against the default value
        defValue - the default value to compare against
        Returns:
        true if both are equal
      • getCustomDisplayInstance

        protected EnumWithCustomDisplay getCustomDisplayInstance()
        Tries to instantiate an instance of the enumeration type.
        Returns:
        the instance or null if failed to instantiate
        See Also:
        m_CustomDisplayInstance
      • getEnumInstance

        public static EnumWithCustomDisplay getEnumInstance​(Class cls)
        Tries to instantiate an instance of the enumeration type.
        Parameters:
        cls - the enum class
        Returns:
        the instance or null if failed to instantiate
      • toString

        public String toString​(Object obj)
        Returns a string representation of the specified object.
        Specified by:
        toString in class AbstractArgumentOption
        Parameters:
        obj - the object to turn into a string
        Returns:
        the string representation
      • 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