Package adams.core.option
Interface OptionConsumer<C,V>
-
- Type Parameters:
C
- the type of data to consumeV
- the type of data used for values
- All Superinterfaces:
CleanUpHandler
- All Known Subinterfaces:
OptionConsumerWithOptionHandling<C,V>
- All Known Implementing Classes:
AbstractOptionConsumer
,AbstractRecursiveOptionConsumer
,ArrayConsumer
,CompactFlowConsumer
,JsonConsumer
,NestedConsumer
public interface OptionConsumer<C,V> extends CleanUpHandler
Interface for classes that set the option values based on the input data.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
cleanUp()
Cleans up data structures, frees up memory.OptionHandler
consume()
Consumes the current input.OptionHandler
consume(OptionHandler output, C input)
Consumes the provided input and updates the provided option handler.OptionHandler
fromFile(File file)
Processes the specified file.OptionHandler
fromString(String s)
Processes the specified string.MessageCollection
getErrors()
Returns the error log.C
getInput()
Returns the currently set input data.LoggingLevel
getLoggingLevel()
Returns the logging level.OptionHandler
getOutput()
Returns the visited top-level object.HashSet<String>
getSkippedProperties()
Returns the skipped top-level properties.MessageCollection
getWarnings()
Returns the warning log.String
globalInfo()
Returns a string describing the object.boolean
hasErrors()
Checks whether errors were encountered while consuming the options.boolean
hasWarnings()
Checks whether warnings were encountered while consuming the options.boolean
isQuiet()
Returns whether console output is suppressed or not.OptionHandler
read(String filename)
Reads the option handler from the specified file.void
setInput(C input)
Sets the input data to use.void
setLoggingLevel(LoggingLevel value)
Sets the logging level.void
setQuiet(boolean value)
Sets whether console output is suppressed or not.void
setSkippedProperties(HashSet<String> value)
Sets the top-level properties to skip.
-
-
-
Method Detail
-
globalInfo
String globalInfo()
Returns a string describing the object.- Returns:
- a description suitable for displaying in the gui
-
setLoggingLevel
void setLoggingLevel(LoggingLevel value)
Sets the logging level.- Parameters:
value
- the logging level
-
getLoggingLevel
LoggingLevel getLoggingLevel()
Returns the logging level.- Returns:
- the logging level
-
hasErrors
boolean hasErrors()
Checks whether errors were encountered while consuming the options.- Returns:
- true if errors were encountered
- See Also:
getErrors()
-
getErrors
MessageCollection getErrors()
Returns the error log.- Returns:
- the error log, can be empty
- See Also:
hasErrors()
-
hasWarnings
boolean hasWarnings()
Checks whether warnings were encountered while consuming the options.- Returns:
- true if warnings were encountered
- See Also:
getWarnings()
-
getWarnings
MessageCollection getWarnings()
Returns the warning log.- Returns:
- the warning log, can be empty
- See Also:
hasWarnings()
-
setQuiet
void setQuiet(boolean value)
Sets whether console output is suppressed or not.- Parameters:
value
- if true then console output is suppressed (out/err)
-
isQuiet
boolean isQuiet()
Returns whether console output is suppressed or not.- Returns:
- true if console output is suppressed
-
setSkippedProperties
void setSkippedProperties(HashSet<String> value)
Sets the top-level properties to skip.- Parameters:
value
- the properties
-
getSkippedProperties
HashSet<String> getSkippedProperties()
Returns the skipped top-level properties.- Returns:
- the properties
-
getOutput
OptionHandler getOutput()
Returns the visited top-level object.- Returns:
- the visited object
-
setInput
void setInput(C input)
Sets the input data to use.- Parameters:
input
- the data to use
-
getInput
C getInput()
Returns the currently set input data.- Returns:
- the data in use
-
consume
OptionHandler consume()
Consumes the current input. The generated option handler can be retrieved via getOutput() as well.- Returns:
- the created object
- See Also:
getOutput()
-
consume
OptionHandler consume(OptionHandler output, C input)
Consumes the provided input and updates the provided option handler. The option handler can be retrieved via getOutput() as well.- Parameters:
output
- the option handler to updateinput
- the data to use for updating- Returns:
- the updated object
- See Also:
getOutput()
-
fromString
OptionHandler fromString(String s)
Processes the specified string.- Parameters:
s
- the string to process- Returns:
- the created object
- See Also:
getOutput()
-
fromFile
OptionHandler fromFile(File file)
Processes the specified file.- Parameters:
file
- the file to process- Returns:
- the created object, null in case content of file couldn't be loaded
-
read
OptionHandler read(String filename)
Reads the option handler from the specified file.- Parameters:
filename
- the file to read from- Returns:
- the option handler if successful, null otherwise
-
cleanUp
void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
-
-