org.eclipse.viatra.query.runtime.emf.helper

## Class ViatraQueryRuntimeHelper

- java.lang.Object
- - org.eclipse.viatra.query.runtime.emf.helper.ViatraQueryRuntimeHelper

-     public class ViatraQueryRuntimeHelper
      extends java.lang.Object

  Helper functions for dealing with the EMF objects with VIATRA Queries.
  Since:
    0.9

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static org.eclipse.emf.ecore.EStructuralFeature` | `getFeature(java.lang.Object o, java.lang.String featureName)` Get the structural feature with the given name of the given object.
    `static java.lang.String` | `getMessage(IPatternMatch match, java.lang.String messageFormat)` Returns the message for the given match using the given format.
    `static java.lang.String` | `getMessage(IPatternMatch match, java.lang.String messageFormat, java.util.function.Function<java.lang.Object,java.lang.String> parameterValueTransformer)` Returns the message for the given match using the given format while transforming values with the given function.
    `static java.lang.String` | `prettyPrintEMFType(java.lang.Object typeObject)` Gives a human-readable name of an EMF type.

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

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

- - ### Method Detail

    - #### prettyPrintEMFType

          public static java.lang.String prettyPrintEMFType(java.lang.Object typeObject)

      Gives a human-readable name of an EMF type.

    - #### getFeature

          public static org.eclipse.emf.ecore.EStructuralFeature getFeature(java.lang.Object o,
                                                                            java.lang.String featureName)

      Get the structural feature with the given name of the given object.
      Parameters:
        `o` - the object (must be an EObject)
        `featureName` - the name of the feature
      Returns:
        the EStructuralFeature of the object or null if it can not be found

    - #### getMessage

          public static java.lang.String getMessage(IPatternMatch match,
                                                    java.lang.String messageFormat)

      Returns the message for the given match using the given format. The format string can refer to the value of parameter A of the match with $A$ and even access features of A (if it's an EObject), e.g. $A.id$.

      If the selected parameter does not exist, the string "[no such parameter]" is added

      If no feature is defined, but A has a feature called "name", then its value is used.

      If the selected feature does not exist, A.toString() is added.

      If the selected feature is null, the string "null" is added.
      Parameters:
        `match` - cannot be null!
        `messageFormat` - cannot be null!

    - #### getMessage

          public static java.lang.String getMessage(IPatternMatch match,
                                                    java.lang.String messageFormat,
                                                    java.util.function.Function<java.lang.Object,java.lang.String> parameterValueTransformer)

      Returns the message for the given match using the given format while transforming values with the given function. The format string can refer to the value of parameter A of the match with $A$ and even access features of A (if it's an EObject), e.g. $A.id$. The function will be called to compute the final string representation of the values selected by the message format.

      If the selected parameter does not exist, the string "[no such parameter]" is added

      If no feature is defined, but A has a feature called "name", then its value is passed to the function.

      If the selected feature does not exist, A is passed to the function.

      If the selected feature is null, the string "null" is added.
      Parameters:
        `match` - cannot be null!
        `messageFormat` - cannot be null!
        `parameterValueTransformer` - cannot be null!
      Since:
        2.0