java.lang.Object
javax0.jamal.tools.OptionsStore
- All Implemented Interfaces:
javax0.jamal.api.Identified
public class OptionsStore extends Object implements javax0.jamal.api.Identified
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description static String
OPTIONS_MACRO_ID
-
Constructor Summary
Constructors Constructor Description OptionsStore()
-
Method Summary
Modifier and Type Method Description void
addOptions(String... options)
Add the options to this options store.void
addOptions(Set<String> options)
Add the options to this options store.String
getId()
The name of the macro is`options
that starts with a backtick.static OptionsStore
getInstance(javax0.jamal.api.Processor processor)
Get the options store that belongs to this processor at this very moment.Set<String>
getOptions()
Get the set of options.boolean
is(String option)
Decides if a certain option was set in this option store.
-
Field Details
-
OPTIONS_MACRO_ID
- See Also:
- Constant Field Values
-
-
Constructor Details
-
OptionsStore
public OptionsStore()
-
-
Method Details
-
getInstance
Get the options store that belongs to this processor at this very moment.Note that this is not safe to store the result of this method for longer time, because the actual store may be changed when the scope of the processor is going up closing a macro nesting level.
- Parameters:
processor
- the processor of which we need the options store- Returns:
- the options store. If there was no option defined for this processor then it returns a constant empty options store
-
getId
The name of the macro is`options
that starts with a backtick. This is a character that is not allowed in a macro name. This way the macro instances will be stored in the macro register when it gets registered programmatically, but the macro source cannot reference it and also the built-in macrodefine
will not overwrite it.- Specified by:
getId
in interfacejavax0.jamal.api.Identified
- Returns:
- the constant string
`options
-
addOptions
Add the options to this options store. If an option starts with the~
character then it will be removed from the options. This way it is possible to switch off an option.- Parameters:
options
- the options to add to the store
-
addOptions
Add the options to this options store. Note that the set of options in this case come from an already existing options store, and thus the strings MUST NOT and CANNOT contain the leading~
character.- Parameters:
options
- the options to add to the store
-
getOptions
Get the set of options.- Returns:
- the options set
-
is
Decides if a certain option was set in this option store.- Parameters:
option
- the option we look for- Returns:
true
if the option was set for this store
-