org.jbpm.services.api.query

## Class QueryMapperRegistry

- java.lang.Object
- - org.jbpm.services.api.query.QueryMapperRegistry

-     public class QueryMapperRegistry
      extends Object

  Allow to find mappers by name instead of using their instances Mappers are discovered by ServiceLoader mechanism - meaning must be defined in services file:
  META-INF/services/org.jbpm.services.api.query.QueryResultMapper
  as fully qualified class names that implement `org.jbpm.services.api.query.QueryResultMapper`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static org.slf4j.Logger` | `logger`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `QueryMapperRegistry()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMapper(QueryResultMapper<?> mapper)` Adds a new query results mapper
    `List<String>` | `discoverAndAddMappers(ClassLoader cl)` Discovers and adds all `QueryResultMappers` to the known set.
    `static QueryMapperRegistry` | `get()` Returns instance of the registry that is already populated with known mappers.
    `QueryResultMapper<?>` | `mapperFor(String name, Map<String,String> columnMapping)` Returns mapper for given name if found.
    `void` | `removeMapper(String mapperName)` Removes a query results mapper.

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

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

- - ### Field Detail

    - #### logger

          public static final org.slf4j.Logger logger

  - ### Constructor Detail

    - #### QueryMapperRegistry

          protected QueryMapperRegistry()

  - ### Method Detail

    - #### get

          public static QueryMapperRegistry get()

      Returns instance of the registry that is already populated with known mappers.
      Returns:
        @`QueryMapperRegistry` registry

    - #### mapperFor

          public QueryResultMapper<?> mapperFor(String name,
                                                Map<String,String> columnMapping)

      Returns mapper for given name if found.
      Parameters:
        `name` - unique name that mapper is bound to
        `columnMapping` - provides column mapping (name to type) that can be shipped to mapper for improved transformation - can be null (accepted types: string, long, integer, date, double)
      Returns:
        instance of the `QueryResultMapper` if found
      Throws:
        `IllegalArgumentException` - in case there is no mapper found with given name

    - #### discoverAndAddMappers

          public List<String> discoverAndAddMappers(ClassLoader cl)

      Discovers and adds all `QueryResultMappers` to the known set.
      Parameters:
        `cl` - class laoder used to discover mappers
      Returns:
        returns list of added (not previously existing) mappers

    - #### addMapper

          public void addMapper(QueryResultMapper<?> mapper)

      Adds a new query results mapper
      Parameters:
        `mapper` -

    - #### removeMapper

          public void removeMapper(String mapperName)

      Removes a query results mapper.
      Parameters:
        `mapperName` -

Copyright © 2001–2019 JBoss by Red Hat. All rights reserved.