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 Description PAnnotation(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(java.lang.String attributeName, java.lang.Object value)
Adds an attribute to the annotationvoid
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 annotationjava.util.List<java.lang.Object>
getAllValues(java.lang.String attributeName)
Returns all values of a selected attributejava.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 attributejava.lang.String
getName()
Return the name of the annotation
-
-
-
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
-
-