Class StandardizerConfiguration
- All Implemented Interfaces:
Cloneable
Contains a list of
StandardizerAction
instances.
Groups of actions can be created using
addActionToGroup(String, StandardizerAction)
and
addActionToGroups(Collection, StandardizerAction)
methods. Note,
that the StandardizerAction
must be added to the configuration using
addAction(StandardizerAction)
or addActions(List)
prior
added into a group.
The configuration may contain invalid actions, that could not be read from
XML or action string configuration. In all cases these actions must be
instances of InvalidStandardizerAction
. In these cases the root cause
of the error can be gathered using
InvalidStandardizerAction.getErrorMessage()
method.
The validity of the configuration can be checked by the function
isValid()
. If there are invalid
standardizer actions in the configuration, this function returns true. A text
representation of all errors contained by a configuration can be gathered by
the static method
createErrorMessage(StandardizerConfiguration)
.
IMPORTANT NOTE: The groups of the actions should be provided only after the actions are provided!
- Since:
- 5.11
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAction
(StandardizerAction action) Adds an action to the configurationvoid
addActions
(List<StandardizerAction> actions) Adds actions to the configurationvoid
addActionToGroup
(String group, StandardizerAction action) Adds an action to the groupvoid
addActionToGroups
(Collection<String> groups, StandardizerAction action) Adds an action to a list of groupsvoid
clear()
Clears the configuration of actionclone()
Clones the configurationstatic String
createErrorMessage
(StandardizerConfiguration configuration) Creates an error message based on an invalid configurationint
Gets the action count of the configurationgetActionIndexes
(String actionString) Gets the indexes of actions defined by the provided action stringGets all actions of the configurationgetActions
(String group) Gets actions of a group of the configurationgetActions
(String... groups) Gets actions of a group of the configurationgetGroupsOf
(StandardizerAction action) Gets the group names associated to an action separated by , characterint
getLastIndexOfAction
(String token) Gets the last index of an action defined by the provided action stringboolean
isEmpty()
Gets whether the configuration contains actionsboolean
isValid()
Gets whether the configuration contains only valid elementsvoid
removeAction
(StandardizerAction action) Removes an action of the configurationvoid
removeActions
(Collection<StandardizerAction> actions) Removes actions of the configurationtoString()
-
Constructor Details
-
StandardizerConfiguration
public StandardizerConfiguration()
-
-
Method Details
-
addAction
Adds an action to the configuration- Parameters:
action
- the action to be added to the configuration
-
addActions
Adds actions to the configuration- Parameters:
actions
- the actions to be added to the configuration
-
removeAction
Removes an action of the configuration- Parameters:
action
- the action to be removed to the configuration
-
removeActions
Removes actions of the configuration- Parameters:
actions
- the actions to be removed to the configuration
-
getActions
Gets all actions of the configuration- Returns:
- all actions of the configuration
-
getActions
Gets actions of a group of the configuration- Parameters:
group
- the name of the group (case sensitive)- Returns:
- actions of a group of the configuration
-
getActions
Gets actions of a group of the configuration- Parameters:
groups
- the name of the group (case sensitive)- Returns:
- actions of a group of the configuration
-
addActionToGroup
Adds an action to the group- Parameters:
group
- the name of the groupaction
- the standardizer action
-
addActionToGroups
Adds an action to a list of groups- Parameters:
groups
- the list of the group namesaction
- the standardizer action
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
cloneConfiguration
Clones the configuration- Returns:
- the clone of the configuration
-
isEmpty
public boolean isEmpty()Gets whether the configuration contains actions- Returns:
- true is the configuration does not contains actions
-
clear
public void clear()Clears the configuration of action -
toString
-
getActionCount
public int getActionCount()Gets the action count of the configuration- Returns:
- the action count of the configuration
-
getLastIndexOfAction
Gets the last index of an action defined by the provided action string- Parameters:
token
- the action string token of the action- Returns:
- the last index of an action defined by the provided action string
-
getActionIndexes
Gets the indexes of actions defined by the provided action string- Parameters:
actionString
- the action string token of the task- Returns:
- indexes of actions defined by the provided action string
-
getGroupsOf
Gets the group names associated to an action separated by , character- Parameters:
action
- the target action- Returns:
- the groups associated to the action
-
isValid
public boolean isValid()Gets whether the configuration contains only valid elements- Returns:
- true if the configuration contains only valid elements
-
createErrorMessage
Creates an error message based on an invalid configuration- Parameters:
configuration
- the base configuration- Returns:
- the proper error message for the configuration
-