net.sf.okapi.lib.xliff2.validation

## Class Validation

- java.lang.Object
- - net.sf.okapi.lib.xliff2.core.BaseList<Rule>
  - - net.sf.okapi.lib.xliff2.validation.Validation

- All Implemented Interfaces:
    java.lang.Iterable<Rule>, IWithExtAttributes

      public class Validation
      extends BaseList<Rule>
      implements IWithExtAttributes

  Represents the <validation> element of the Validation module.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Validation()` Creates an empty `Validation` object.
    `Validation(Validation original, boolean markAsInherited)` Copy constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addDeclaration()`
    `int` | `getDeclarationCount()`
    `ExtAttributes` | `getExtAttributes()` Gets the `ExtAttributes` object for the parent object.
    `java.lang.String` | `getExtAttributeValue(java.lang.String namespaceURI, java.lang.String localName)` Gets the value for a given extension attribute.
    `boolean` | `hasExtAttribute()` Indicates if at least one extension attribute is present.
    `boolean` | `hasNonInheritedRule()` Indicates if this list of rules has at least one that is not inherited.
    `void` | `prepare()` Prepare the rules for performing the validation tasks.
    `java.util.List<Issue>` | `processRules(Unit unit, java.lang.String fileId)` Applies the rules of this object on a given unit.
    `void` | `setExtAttributes(ExtAttributes attributes)` Sets the `ExtAttributes` object associated with this object.

    - ### Methods inherited from class net.sf.okapi.lib.xliff2.core.BaseList

      `add, clear, get, isEmpty, iterator, remove, remove, set, size`

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

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

- - ### Constructor Detail

    - #### Validation

          public Validation()

      Creates an empty `Validation` object.

    - #### Validation

          public Validation(Validation original,
                    boolean markAsInherited)

      Copy constructor.
      Parameters:
        `original` - the original object to duplicate.
        `markAsInherited` - true to mark all rules in the clone as inherited, false to leave them as they are.

  - ### Method Detail

    - #### setExtAttributes

          public void setExtAttributes(ExtAttributes attributes)

      Description copied from interface: `IWithExtAttributes`
      Sets the `ExtAttributes` object associated with this object.
      Specified by:
        `setExtAttributes` in interface `IWithExtAttributes`
      Parameters:
        `attributes` - the `ExtAttributes` object associated with this object. If null, a new `ExtAttributes` object is created.

    - #### getExtAttributes

          public ExtAttributes getExtAttributes()

      Description copied from interface: `IWithExtAttributes`
      Gets the `ExtAttributes` object for the parent object. If none exists, one is created.
      Specified by:
        `getExtAttributes` in interface `IWithExtAttributes`
      Returns:
        the `ExtAttributes` object for the parent object, never null.

    - #### hasExtAttribute

          public boolean hasExtAttribute()

      Description copied from interface: `IWithExtAttributes`
      Indicates if at least one extension attribute is present.
      Specified by:
        `hasExtAttribute` in interface `IWithExtAttributes`
      Returns:
        true if at least one extension attribute is present; false otherwise.

    - #### getExtAttributeValue

          public java.lang.String getExtAttributeValue(java.lang.String namespaceURI,
                                              java.lang.String localName)

      Description copied from interface: `IWithExtAttributes`
      Gets the value for a given extension attribute.
      Specified by:
        `getExtAttributeValue` in interface `IWithExtAttributes`
      Parameters:
        `namespaceURI` - the URI of the namespace for the attribute.
        `localName` - the name of the attribute.
      Returns:
        the value of the extension attribute, or null if it does not exist.

    - #### hasNonInheritedRule

          public boolean hasNonInheritedRule()

      Indicates if this list of rules has at least one that is not inherited.
      Returns:
        true if there is one or more non=inherited rule, false otherwise.

    - #### prepare

          public void prepare()

      Prepare the rules for performing the validation tasks. You must call this method before calling `processRules(Unit, String)`.

    - #### processRules

          public java.util.List<Issue> processRules(Unit unit,
                                           java.lang.String fileId)

      Applies the rules of this object on a given unit. You must call `prepare()` before calling this method (if a rule has changed since the last call).
      Parameters:
        `unit` - the unit to validate.
        `fileId` - the id of the file of the unit.
      Returns:
        null if no rule was processed or a list of issues that may be empty.

    - #### getDeclarationCount

          public int getDeclarationCount()

    - #### addDeclaration

          public void addDeclaration()