Class ModelWalker<DATA>

  • Type Parameters:
    DATA - state information that is carried through the walk
    Direct Known Subclasses:
    DefinitionCollectingModelWalker

    public abstract class ModelWalker<DATA>
    extends Object
    Walks a Metaschema model. The "visit" methods can be implemented by child classes to perform processing on a visited node.
    • Method Detail

      • getDefaultData

        protected abstract DATA getDefaultData()
        Generate default state information.
        Returns:
        the state information
      • walk

        public void walk​(@NonNull
                         IFlagDefinition flag)
        Will visit the provided metaschema flag definition.
        Parameters:
        flag - the metaschema flag definition to walk
      • walk

        public void walk​(@NonNull
                         IFlagDefinition flag,
                         DATA data)
        Will visit the provided metaschema flag definition.
        Parameters:
        flag - the metaschema flag definition to walk
        data - additional state information to operate on
      • walk

        public void walk​(@NonNull
                         IFieldDefinition field)
        Will visit the provided metaschema field definition, and then walk the associated flag instances.
        Parameters:
        field - the metaschema field definition to walk
      • walk

        public void walk​(@NonNull
                         IFieldDefinition field,
                         DATA data)
        Will visit the provided metaschema field definition, and then walk the associated flag instances.
        Parameters:
        field - the metaschema field definition to walk
        data - additional state information to operate on
      • walk

        public void walk​(@NonNull
                         IAssemblyDefinition assembly)
        Will visit the provided metaschema assembly definition, and then walk the associated flag and model instances.
        Parameters:
        assembly - the metaschema assembly definition to walk
      • walk

        public void walk​(@NonNull
                         IAssemblyDefinition assembly,
                         DATA data)
        Will visit the provided metaschema assembly definition, and then walk the associated flag and model instances.
        Parameters:
        assembly - the metaschema assembly definition to walk
        data - additional state information to operate on
      • walk

        public void walk​(@NonNull
                         IFlagInstance instance,
                         DATA data)
        Will visit the provided metaschema flag instance, and then walk the associated flag definition.
        Parameters:
        instance - the metaschema flag instance to walk
        data - additional state information to operate on
      • walk

        public void walk​(@NonNull
                         IFieldInstance instance,
                         DATA data)
        Will visit the provided metaschema field instance, and then walk the associated field definition.
        Parameters:
        instance - the metaschema field instance to walk
        data - additional state information to operate on
      • walk

        public void walk​(@NonNull
                         IAssemblyInstance instance,
                         DATA data)
        Will visit the provided metaschema assembly instance, and then walk the associated assembly definition.
        Parameters:
        instance - the metaschema assembly instance to walk
        data - additional state information to operate on
      • walk

        public void walk​(@NonNull
                         IChoiceInstance instance,
                         DATA data)
        Will visit the provided metaschema choice instance, and then walk the choice's child model instances.
        Parameters:
        instance - the metaschema choice instance to walk
        data - additional state information to operate on
      • walkDefinition

        public void walkDefinition​(@NonNull
                                   IDefinition definition)
        Will walk the provided model definition.
        Parameters:
        definition - the definition to walk
      • walkDefinition

        public void walkDefinition​(@NonNull
                                   IDefinition definition,
                                   DATA data)
        Will walk the provided model definition.
        Parameters:
        definition - the definition to walk
        data - additional state information to operate on
      • walkFlagInstances

        protected void walkFlagInstances​(@NonNull
                                         Collection<? extends IFlagInstance> instances,
                                         DATA data)
        Will walk each of the provided flag instances.
        Parameters:
        instances - a collection of flag instances to visit
        data - additional state information to operate on
      • walkModelInstances

        protected void walkModelInstances​(@NonNull
                                          Collection<? extends IModelInstance> instances,
                                          DATA data)
        Will walk each of the provided model instances.
        Parameters:
        instances - a collection of model instances to visit
        data - additional state information to operate on
      • walkModelInstance

        protected void walkModelInstance​(@NonNull
                                         IModelInstance instance,
                                         DATA data)
        Will walk the provided model instance.
        Parameters:
        instance - the instance to walk
        data - additional state information to operate on
      • visit

        protected abstract void visit​(@NonNull
                                      IFlagDefinition def,
                                      DATA data)
        Called when the provided definition is walked. This can be overridden by child classes to enable processing of the visited definition.
        Parameters:
        def - the definition that is visited
        data - additional state information to operate on
      • visit

        protected boolean visit​(@NonNull
                                IFieldDefinition def,
                                DATA data)
        Called when the provided definition is walked. This can be overridden by child classes to enable processing of the visited definition.
        Parameters:
        def - the definition that is visited
        data - additional state information to operate on
        Returns:
        true if child instances are to be walked, or false otherwise
      • visit

        protected boolean visit​(@NonNull
                                IAssemblyDefinition def,
                                DATA data)
        Called when the provided definition is walked. This can be overridden by child classes to enable processing of the visited definition.
        Parameters:
        def - the definition that is visited
        data - additional state information to operate on
        Returns:
        true if child instances are to be walked, or false otherwise
      • visit

        protected boolean visit​(@NonNull
                                IFlagInstance instance,
                                DATA data)
        Called when the provided instance is walked. This can be overridden by child classes to enable processing of the visited instance.
        Parameters:
        instance - the instance that is visited
        data - additional state information to operate on
        Returns:
        true if the associated definition is to be walked, or false otherwise
      • visit

        protected boolean visit​(@NonNull
                                IFieldInstance instance,
                                DATA data)
        Called when the provided instance is walked. This can be overridden by child classes to enable processing of the visited instance.
        Parameters:
        instance - the instance that is visited
        data - additional state information to operate on
        Returns:
        true if the associated definition is to be walked, or false otherwise
      • visit

        protected boolean visit​(@NonNull
                                IAssemblyInstance instance,
                                DATA data)
        Called when the provided instance is walked. This can be overridden by child classes to enable processing of the visited instance.
        Parameters:
        instance - the instance that is visited
        data - additional state information to operate on
        Returns:
        true if the associated definition is to be walked, or false otherwise
      • visit

        protected boolean visit​(@NonNull
                                IChoiceInstance instance,
                                DATA data)
        Called when the provided instance is walked. This can be overridden by child classes to enable processing of the visited instance.
        Parameters:
        instance - the instance that is visited
        data - additional state information to operate on
        Returns:
        true if the child instances are to be walked, or false otherwise