com.microfocus.awm.meta.util

## Class SimpleRule

- java.lang.Object
- - com.microfocus.awm.meta.util.SimpleRule

- All Implemented Interfaces:
    ILowLevelConvertionRule

      public class SimpleRule
      extends java.lang.Object
      implements ILowLevelConvertionRule

  Rule for the `TaurusModelConverter` to convert a single line of an AWM XML model.
  Author:
    Micro Focus

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleRule(java.lang.String pOutdatedValue, java.lang.String pNewValue)` Creates a new simple AWM model converter rule.
    `SimpleRule(java.lang.String pOutdatedValue, java.lang.String pNewValue, java.lang.String[] pAdditionalLineStrings, java.lang.String[] pForbiddenLineStrings)` Creates a new simple AWM model converter rule with additional line checks.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `convertLine(java.lang.String pLine)` Attempts to convert the given line from an AWM XML model.
    `java.lang.String[]` | `getAdditionalLineStrings()` Gets the additional line strings.
    `java.lang.String[]` | `getForbiddenLineStrings()` Gets the forbidden line strings.
    `java.lang.String` | `getNewValue()` Gets the new value of this rule.
    `java.lang.String` | `getOutdatedValue()` Gets the outdated value of this rule (the value to be replaced).
    `int` | `getSpecialRule()` For internal use only.
    `boolean` | `hasAdditionalLineStrings()` Whether the rule has additional line strings to check for.
    `boolean` | `hasForbiddenLineStrings()` Whether the rule has forbidden line strings to check for.
    `void` | `setSpecialRule(int pSpecialRule)` For internal use only.

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

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

- - ### Constructor Detail

    - #### SimpleRule

          public SimpleRule(java.lang.String pOutdatedValue,
                            java.lang.String pNewValue,
                            java.lang.String[] pAdditionalLineStrings,
                            java.lang.String[] pForbiddenLineStrings)

      Creates a new simple AWM model converter rule with additional line checks.
      Parameters:
        `pOutdatedValue` - the old value to be replaced
        `pNewValue` - the new value
        `pAdditionalLineStrings` - (optional, can be `null`) an array of strings that has to be in the checked line. If a single string is not found, the replacement will not be applied.
        `pForbiddenLineStrings` - (optional, can be `null`) an array of strings that must not be in the checked line. If a single string is found, the replacement will not be applied.

    - #### SimpleRule

          public SimpleRule(java.lang.String pOutdatedValue,
                            java.lang.String pNewValue)

      Creates a new simple AWM model converter rule.
      Parameters:
        `pOutdatedValue` - the old value to be replaced
        `pNewValue` - the new value

  - ### Method Detail

    - #### getOutdatedValue

          public java.lang.String getOutdatedValue()

      Gets the outdated value of this rule (the value to be replaced).
      Specified by:
        `getOutdatedValue` in interface `ILowLevelConvertionRule`
      Returns:
        the outdated value

    - #### getNewValue

          public java.lang.String getNewValue()

      Gets the new value of this rule.
      Specified by:
        `getNewValue` in interface `ILowLevelConvertionRule`
      Returns:
        the new value

    - #### getAdditionalLineStrings

          public java.lang.String[] getAdditionalLineStrings()

      Gets the additional line strings. If a single string is not found in the checked AWM model line, the rule will not be applied.
      Returns:
        the array of additional line strings (can be `null`)
      See Also:
        `hasAdditionalLineStrings()`

    - #### hasAdditionalLineStrings

          public boolean hasAdditionalLineStrings()

      Whether the rule has additional line strings to check for.
      Returns:
        `true` if additional line strings were defined
      See Also:
        `getAdditionalLineStrings()`

    - #### getForbiddenLineStrings

          public java.lang.String[] getForbiddenLineStrings()

      Gets the forbidden line strings. If a single string is found in the checked AWM model line, the rule will not be applied.
      Returns:
        the array of forbidden line strings (can be `null`)
      See Also:
        `hasForbiddenLineStrings()`

    - #### hasForbiddenLineStrings

          public boolean hasForbiddenLineStrings()

      Whether the rule has forbidden line strings to check for.
      Returns:
        `true` if forbidden line strings were defined
      See Also:
        `getForbiddenLineStrings()`

    - #### getSpecialRule

          public int getSpecialRule()

      For internal use only.
      Returns:
        the special rule constant

    - #### setSpecialRule

          public void setSpecialRule(int pSpecialRule)

      For internal use only.
      Parameters:
        `pSpecialRule` - the special rule constant

    - #### convertLine

          public java.lang.String convertLine(java.lang.String pLine)

      Description copied from interface: `ILowLevelConvertionRule`
      Attempts to convert the given line from an AWM XML model. If no conversion is done, the original line must be returned.
      Specified by:
        `convertLine` in interface `ILowLevelConvertionRule`
      Parameters:
        `pLine` - the line for potential conversion
      Returns:
        the converted or unchanged line

Copyright © 2015 Micro Focus GmbH. All rights reserved.