Class DefinitionCollectingModelWalker
- java.lang.Object
-
- gov.nist.secauto.metaschema.core.model.ModelWalker<Void>
-
- gov.nist.secauto.metaschema.core.model.DefinitionCollectingModelWalker
-
- Direct Known Subclasses:
UsedDefinitionModelWalker
public abstract class DefinitionCollectingModelWalker extends ModelWalker<Void>
Supports walking a portion of a metaschema model collecting a set of definitions that match the provided filter. For a definition to be collected, the filter must returntrue
.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefinitionCollectingModelWalker(Function<IDefinition,Boolean> filter)
Construct a new walker using the provided filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Void
getDefaultData()
Generate default state information.Collection<? extends IDefinition>
getDefinitions()
Return the collection of definitions matching the configured filter.protected Function<IDefinition,Boolean>
getFilter()
Retrieves the filter used for matching.protected boolean
visit(IAssemblyDefinition def, Void data)
Called when the provided definition is walked.protected boolean
visit(IFieldDefinition def, Void data)
Called when the provided definition is walked.protected void
visit(IFlagDefinition def, Void data)
Called when the provided definition is walked.-
Methods inherited from class gov.nist.secauto.metaschema.core.model.ModelWalker
visit, visit, visit, visit, walk, walk, walk, walk, walk, walk, walk, walk, walk, walk, walkDefinition, walkDefinition, walkFlagInstances, walkModelInstance, walkModelInstances
-
-
-
-
Constructor Detail
-
DefinitionCollectingModelWalker
protected DefinitionCollectingModelWalker(Function<IDefinition,Boolean> filter)
Construct a new walker using the provided filter.- Parameters:
filter
- the filter to match definitions against
-
-
Method Detail
-
getDefaultData
protected Void getDefaultData()
Description copied from class:ModelWalker
Generate default state information.- Specified by:
getDefaultData
in classModelWalker<Void>
- Returns:
- the state information
-
getFilter
protected Function<IDefinition,Boolean> getFilter()
Retrieves the filter used for matching.- Returns:
- the filter
-
getDefinitions
@NonNull public Collection<? extends IDefinition> getDefinitions()
Return the collection of definitions matching the configured filter.- Returns:
- the collection of definitions
-
visit
protected void visit(IFlagDefinition def, Void data)
Description copied from class:ModelWalker
Called when the provided definition is walked. This can be overridden by child classes to enable processing of the visited definition.- Specified by:
visit
in classModelWalker<Void>
- Parameters:
def
- the definition that is visiteddata
- additional state information to operate on
-
visit
protected boolean visit(IFieldDefinition def, Void data)
Description copied from class:ModelWalker
Called when the provided definition is walked. This can be overridden by child classes to enable processing of the visited definition.- Overrides:
visit
in classModelWalker<Void>
- Parameters:
def
- the definition that is visiteddata
- additional state information to operate on- Returns:
true
if child instances are to be walked, orfalse
otherwise
-
visit
protected boolean visit(IAssemblyDefinition def, Void data)
Description copied from class:ModelWalker
Called when the provided definition is walked. This can be overridden by child classes to enable processing of the visited definition.- Overrides:
visit
in classModelWalker<Void>
- Parameters:
def
- the definition that is visiteddata
- additional state information to operate on- Returns:
true
if child instances are to be walked, orfalse
otherwise
-
-