<commit_before>/*
 * Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.types.idol.marshalling;

import com.autonomy.aci.client.services.Processor;
import com.hp.autonomy.types.idol.responses.QueryResponse;
import com.hp.autonomy.types.idol.marshalling.marshallers.DocumentGenerator;
import com.hp.autonomy.types.idol.marshalling.marshallers.MarshallerFactory;
import com.hp.autonomy.types.idol.marshalling.marshallers.ResponseDataParser;
import com.hp.autonomy.types.idol.marshalling.marshallers.ResponseParser;
import com.hp.autonomy.types.idol.marshalling.processors.ResponseDataProcessor;
import com.hp.autonomy.types.idol.marshalling.processors.VoidProcessor;
import com.hp.autonomy.types.idol.marshalling.processors.WrapperProcessor;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;

import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Supplier;

class ProcessorFactoryImpl implements ProcessorFactory {
    private final MarshallerFactory marshallerFactory;
    private final ResponseParser responseParser;

    private final Map<Class<?>, ResponseDataParser<?>> responseDataMarshallerMap = new ConcurrentHashMap<>();
    private final Map<QueryResponseCacheKey<?, ?>, ResponseDataParser<?>> queryResponseDataMarshallerMap = new ConcurrentHashMap<>();
    private final Map<Class<?>, DocumentGenerator<?>> documentGeneratorMap = new ConcurrentHashMap<>();

    ProcessorFactoryImpl(final MarshallerFactory marshallerFactory) {
        this.marshallerFactory = marshallerFactory;
        responseParser = marshallerFactory.getResponseParser();
    }

    @Override
    public Processor<Void> getVoidProcessor() {
        return new VoidProcessor(responseParser);
    }<commit_msg>[FIND-969] Allow creation of processors without autowiring<commit_after>/*
 * Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.types.idol.marshalling;

import com.autonomy.aci.client.services.Processor;
import com.hp.autonomy.types.idol.responses.QueryResponse;
import com.hp.autonomy.types.idol.marshalling.marshallers.DocumentGenerator;
import com.hp.autonomy.types.idol.marshalling.marshallers.MarshallerFactory;
import com.hp.autonomy.types.idol.marshalling.marshallers.ResponseDataParser;
import com.hp.autonomy.types.idol.marshalling.marshallers.ResponseParser;
import com.hp.autonomy.types.idol.marshalling.processors.ResponseDataProcessor;
import com.hp.autonomy.types.idol.marshalling.processors.VoidProcessor;
import com.hp.autonomy.types.idol.marshalling.processors.WrapperProcessor;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;

import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Supplier;

public class ProcessorFactoryImpl implements ProcessorFactory {
    private final MarshallerFactory marshallerFactory;
    private final ResponseParser responseParser;

    private final Map<Class<?>, ResponseDataParser<?>> responseDataMarshallerMap = new ConcurrentHashMap<>();
    private final Map<QueryResponseCacheKey<?, ?>, ResponseDataParser<?>> queryResponseDataMarshallerMap = new ConcurrentHashMap<>();
    private final Map<Class<?>, DocumentGenerator<?>> documentGeneratorMap = new ConcurrentHashMap<>();

    @SuppressWarnings("WeakerAccess")
    public ProcessorFactoryImpl(final MarshallerFactory marshallerFactory) {
        this.marshallerFactory = marshallerFactory;
        responseParser = marshallerFactory.getResponseParser();
    }

    @Override
    public Processor<Void> getVoidProcessor() {
        return new VoidProcessor(responseParser);
    }
{'fraction_non_alphanumeric': 0.0945310566691413, 'fraction_numerical': 0.002722098490472655, 'mean_word_length': 5.95697074010327, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6081038', 'n_tokens_mistral': 1121, 'n_tokens_neox': 1128, 'n_words': 227}