org.eclipse.viatra.query.runtime.matchers.psystem.annotations

## Class PAnnotation

- java.lang.Object
- - org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation

-     public class PAnnotation
      extends java.lang.Object

  A container describing query annotations

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PAnnotation(java.lang.String name)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAttribute(java.lang.String attributeName, java.lang.Object value)` Adds an attribute to the annotation
    `void` | `forEachValue(java.util.function.BiConsumer<java.lang.String,java.lang.Object> consumer)` Executes a consumer over all attributes.
    `java.util.Set<java.lang.String>` | `getAllAttributeNames()` Returns a set of all attribute names used in this annotation
    `java.util.List<java.lang.Object>` | `getAllValues(java.lang.String attributeName)` Returns all values of a selected attribute
    `java.util.Optional<java.lang.Object>` | `getFirstValue(java.lang.String attributeName)` Returns the value of the first occurrence of an attribute
    `<T> java.util.Optional<T>` | `getFirstValue(java.lang.String attributeName, java.lang.Class<T> clazz)` Returns the value of the first occurrence of an attribute
    `java.lang.String` | `getName()` Return the name of the annotation

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

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

- - ### Constructor Detail

    - #### PAnnotation

          public PAnnotation(java.lang.String name)

  - ### Method Detail

    - #### addAttribute

          public void addAttribute(java.lang.String attributeName,
                                   java.lang.Object value)

      Adds an attribute to the annotation
      Parameters:
        `attributeName` -
        `value` -

    - #### getName

          public java.lang.String getName()

      Return the name of the annotation

    - #### getFirstValue

          public java.util.Optional<java.lang.Object> getFirstValue(java.lang.String attributeName)

      Returns the value of the first occurrence of an attribute
      Parameters:
        `attributeName` -
      Returns:
        the attribute value, or null, if attribute is not available
      Since:
        2.0

    - #### getFirstValue

          public <T> java.util.Optional<T> getFirstValue(java.lang.String attributeName,
                                                         java.lang.Class<T> clazz)

      Returns the value of the first occurrence of an attribute
      Parameters:
        `attributeName` -
      Returns:
        the attribute value, or null, if attribute is not available
      Since:
        2.0

    - #### getAllValues

          public java.util.List<java.lang.Object> getAllValues(java.lang.String attributeName)

      Returns all values of a selected attribute
      Parameters:
        `attributeName` -
      Returns:
        a non-null, but possibly empty list of attributes

    - #### forEachValue

          public void forEachValue(java.util.function.BiConsumer<java.lang.String,java.lang.Object> consumer)

      Executes a consumer over all attributes. A selected attribute name (key) can appear (and thus consumed) multiple times.
      Since:
        2.0

    - #### getAllAttributeNames

          public java.util.Set<java.lang.String> getAllAttributeNames()

      Returns a set of all attribute names used in this annotation
      Since:
        2.1