com.hammurapi.extract

## Interface ExtractorFactory

- All Known Implementing Classes:
    ScriptingExtractorFactory

      public interface ExtractorFactory

  Extractor factory service. Creates scripted extractors and predicates. The service is discoverable using the Java Service Loader framework.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `ARGS_BINDING` Binding for arguments arrray if parameter names are not provided.
    `static String` | `CONTEXT_BINDING` Binding for context object.
    `static ExtractorFactory` | `INSTANCE` This instance uses the service loading framework to discover extractor factory providers.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T,V,C> Extractor<T,V,C>` | `createExtractor(String language, String code, String[] parameterNames, Class<T>[] parameterTypes, Class<V> valueType, Class<C> contextType, ClassLoader classLoader)` Creates extractor.
    `<T,C> Predicate<T,C>` | `createPredicate(String language, String code, String[] parameterNames, Class<T>[] parameterTypes, Class<C> contextType, ClassLoader classLoader)` Creates extractor.

- - ### Field Detail

    - #### CONTEXT_BINDING

          static final String CONTEXT_BINDING

      Binding for context object.
      See Also:
        Constant Field Values

    - #### ARGS_BINDING

          static final String ARGS_BINDING

      Binding for arguments arrray if parameter names are not provided.
      See Also:
        Constant Field Values

    - #### INSTANCE

          static final ExtractorFactory INSTANCE

      This instance uses the service loading framework to discover extractor factory providers. It iterates over the providers and invokes provider's createExtractor() methods until it gets not null result which is returned from the method. If there are no providers supporting given language, then null is returned.

  - ### Method Detail

    - #### createExtractor

          <T,V,C> Extractor<T,V,C> createExtractor(String language,
                                                 String code,
                                                 String[] parameterNames,
                                                 Class<T>[] parameterTypes,
                                                 Class<V> valueType,
                                                 Class<C> contextType,
                                                 ClassLoader classLoader)

      Creates extractor.
      Type Parameters:
        `T` - Source objects type.
        `V` - Value type.
      Parameters:
        `language` - Extractor language.
        `code` - Extractor code.
        `parameterTypes` - Extractor parameter types.
        `valueType` - Extractor value type. If this type is Boolean then the factory shall return Predicate.
        `classLoader` - Class loader to use for script evaluation.
      Returns:
        Extractor or null if this factory doesn't support given language.

    - #### createPredicate

          <T,C> Predicate<T,C> createPredicate(String language,
                                             String code,
                                             String[] parameterNames,
                                             Class<T>[] parameterTypes,
                                             Class<C> contextType,
                                             ClassLoader classLoader)

      Creates extractor.
      Type Parameters:
        `T` - Source objects type.
      Parameters:
        `language` - Extractor language.
        `code` - Extractor code.
        `parameterTypes` - Extractor parameter types.
        `valueType` - Extractor value type. If this type is Boolean then the factory shall return Predicate.
        `classLoader` - Class loader to use for script evaluation.
      Returns:
        Extractor or null if this factory doesn't support given language.