public abstract class DeclarationWalker extends Object
ExtensionDeclaration
and invokes methods when important
model components are found.
This is useful to centralize the logic of how to iterate through a
model's structure without coupling to it. For example, the
onOperation(WithOperationsDeclaration, OperationDeclaration)
method allows handling operations without requiring to know that they can exist
at global or configuration level. Something similar can be said
about the onParameter(ParameterizedDeclaration, ParameterGroupDeclaration, ParameterDeclaration)
,
etc.
Constructor and Description |
---|
DeclarationWalker() |
Modifier and Type | Method and Description |
---|---|
protected void |
onConfiguration(ConfigurationDeclaration declaration)
Invoked when a
ConfigurationDeclaration is found in the
traversed extensionDeclaration |
protected void |
onConnectionProvider(ConnectedDeclaration owner,
ConnectionProviderDeclaration declaration)
Invoked when an
ConnectedDeclaration is found in the
traversed extensionDeclaration |
protected void |
onConstruct(WithConstructsDeclaration owner,
ConstructDeclaration declaration)
Invoked when a
ConstructDeclaration is found in the
traversed extensionDeclaration . |
protected void |
onOperation(WithOperationsDeclaration owner,
OperationDeclaration declaration)
Invoked when an
OperationDeclaration is found in the
traversed extensionDeclaration . |
protected void |
onParameter(ParameterizedDeclaration owner,
ParameterGroupDeclaration parameterGroup,
ParameterDeclaration declaration)
Invoked when an
ParameterDeclaration is found in the
traversed extensionDeclaration |
protected void |
onParameterGroup(ParameterizedDeclaration owner,
ParameterGroupDeclaration declaration)
Invoked when an
ParameterGroupDeclaration is found in the
traversed extensionDeclaration |
protected void |
onSource(WithSourcesDeclaration owner,
SourceDeclaration declaration)
Invoked when an
SourceDeclaration is found in the
traversed extensionDeclaration |
protected void |
stop()
When invoked, the traversal of the
ExtensionDeclaration will
stop once the current visit is completed. |
void |
walk(ExtensionDeclaration extensionDeclaration)
Navigates the given
extensionDeclaration and invokes the
other public method's in this class as the navigation
progresses |
public final void walk(ExtensionDeclaration extensionDeclaration)
extensionDeclaration
and invokes the
other public method's in this class as the navigation
progressesextensionDeclaration
- the model to navigateprotected final void stop()
ExtensionDeclaration
will
stop once the current visit is completed.
This will not break the execution within the invoking method,
but instead avoid further traversal of the model from that point on.protected void onConfiguration(ConfigurationDeclaration declaration)
ConfigurationDeclaration
is found in the
traversed extensionDeclaration
declaration
- a ConfigurationDeclaration
protected void onOperation(WithOperationsDeclaration owner, OperationDeclaration declaration)
OperationDeclaration
is found in the
traversed extensionDeclaration
.
owner
- The declaration that owns the operationdeclaration
- the WithOperationsDeclaration
protected void onConstruct(WithConstructsDeclaration owner, ConstructDeclaration declaration)
ConstructDeclaration
is found in the
traversed extensionDeclaration
.
owner
- The declaration that owns the operationdeclaration
- the WithOperationsDeclaration
protected void onConnectionProvider(ConnectedDeclaration owner, ConnectionProviderDeclaration declaration)
ConnectedDeclaration
is found in the
traversed extensionDeclaration
owner
- The declaration that owns the providerdeclaration
- the ConnectionProviderDeclaration
protected void onSource(WithSourcesDeclaration owner, SourceDeclaration declaration)
SourceDeclaration
is found in the
traversed extensionDeclaration
owner
- The declaration that owns the sourcedeclaration
- the SourceDeclaration
protected void onParameterGroup(ParameterizedDeclaration owner, ParameterGroupDeclaration declaration)
ParameterGroupDeclaration
is found in the
traversed extensionDeclaration
owner
- The declaration that owns the parameterdeclaration
- the ParameterGroupDeclaration
protected void onParameter(ParameterizedDeclaration owner, ParameterGroupDeclaration parameterGroup, ParameterDeclaration declaration)
ParameterDeclaration
is found in the
traversed extensionDeclaration
owner
- The declaration that owns the parameterparameterGroup
- the group to which the declaration belongsdeclaration
- the ParameterDeclaration
Copyright © 2018. All rights reserved.