org.thewonderlemming.c4plantuml.linter.rules.builtin

## Class NoOrphanAliasInRelationshipsRule

- java.lang.Object
- - org.thewonderlemming.c4plantuml.linter.rules.AbstractLintingRule
  - - org.thewonderlemming.c4plantuml.linter.rules.builtin.AbstractC4Rule
    - - org.thewonderlemming.c4plantuml.linter.rules.builtin.NoOrphanAliasInRelationshipsRule

-     public class NoOrphanAliasInRelationshipsRule
      extends AbstractC4Rule

  A linting rule that checks that the aliases used in a relationship are declared in the same source file as part of any entity.
  Author:
    thewonderlemming

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NoOrphanAliasInRelationshipsRule(RuleParameters parameters)` Default constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Optional<? extends org.antlr.v4.runtime.tree.ParseTreeListener>` | `createParseTreeListener(org.thewonderlemming.c4plantuml.commons.Reporter reporter, Class<? extends org.antlr.v4.runtime.Parser> parserType)` Returns a `ParseTreeListener` given a `Parser` type.
    `void` | `wrapUp()` Verifies that the collected aliases in use in relationships are all declared.

    - ### Methods inherited from class org.thewonderlemming.c4plantuml.linter.rules.builtin.AbstractC4Rule

      `acceptableParsersTypes, selectParseTree`

    - ### Methods inherited from class org.thewonderlemming.c4plantuml.linter.rules.AbstractLintingRule

      `clearSyntaxErrors, getLogger, getParameters, getSyntaxErrors, reportSyntaxError`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### NoOrphanAliasInRelationshipsRule

          public NoOrphanAliasInRelationshipsRule(RuleParameters parameters)

      Default constructor.

      The `RuleParameters` object that is passed to the class is empty for now as there is no need for any custom parameter.

      Parameters:
        `parameters` - the `RuleParameters` object that is being passed to the rule.

  - ### Method Detail

    - #### createParseTreeListener

          public Optional<? extends org.antlr.v4.runtime.tree.ParseTreeListener> createParseTreeListener(org.thewonderlemming.c4plantuml.commons.Reporter reporter,
                                                                                                         Class<? extends org.antlr.v4.runtime.Parser> parserType)

      Returns a `ParseTreeListener` given a `Parser` type.

      The `Reporter` can be passed at the `ParseTreeListener` if needed.

      Creates a `NoOrphanAliasInRelationshipsListener` instance as a listener.

      Specified by:
        `createParseTreeListener` in class `AbstractLintingRule`
      Parameters:
        `reporter` - the `Reporter` to pass to the new `ParseTreeListener`.
        `parserType` - the `Parser` for the current C4 grammar.
      Returns:
        the `ParseTreeListener` that matches the `Parser` grammar.

    - #### wrapUp

          public void wrapUp()

      Verifies that the collected aliases in use in relationships are all declared.
      Overrides:
        `wrapUp` in class `AbstractC4Rule`

Copyright © 2020. All rights reserved.