// Path: src/main/java/org/blackdread/filtersortjooqapi/exception/FilteringApiException.java
// public class FilteringApiException extends BadUsageApiException {
// 
//     public FilteringApiException(final String message) {
//         super(message);
//     }
// }


import org.blackdread.filtersortjooqapi.exception.FilteringApiException;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
package org.blackdread.filtersortjooqapi.filter.parser;




/**
 * Created by Yoann CAPLAIN on 2017/8/29.
 */
abstract class FilterMultipleValueParserAbstract<R> implements FilterMultipleValueParser<R> {

    FilterMultipleValueParserAbstract() {
    }

    @Override
    public List<R> parse(final String value, final String token) {
        final List<R> parsedValues = Arrays.stream(value.split(token))
//            .map(this::prepareValueForParsing)
            .map(getParser()::parseWithApiException)
            .collect(Collectors.toList());
        // This is a must have as we filter on values so minimum one has to be given/found
        if (parsedValues.isEmpty())
// Path: src/main/java/org/blackdread/filtersortjooqapi/exception/FilteringApiException.java
// public class FilteringApiException extends BadUsageApiException {
// 
//     public FilteringApiException(final String message) {
//         super(message);
//     }
// }


// Path: src/main/java/org/blackdread/filtersortjooqapi/filter/parser/FilterMultipleValueParserAbstract.java
import org.blackdread.filtersortjooqapi.exception.FilteringApiException;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

package org.blackdread.filtersortjooqapi.filter.parser;




/**
 * Created by Yoann CAPLAIN on 2017/8/29.
 */
abstract class FilterMultipleValueParserAbstract<R> implements FilterMultipleValueParser<R> {

    FilterMultipleValueParserAbstract() {
    }

    @Override
    public List<R> parse(final String value, final String token) {
        final List<R> parsedValues = Arrays.stream(value.split(token))
//            .map(this::prepareValueForParsing)
            .map(getParser()::parseWithApiException)
            .collect(Collectors.toList());
        // This is a must have as we filter on values so minimum one has to be given/found
        if (parsedValues.isEmpty())
            throw new FilteringApiException("Parser of value (" + value + ") resulted in no value. Should result in at least one");