class PreConfiguredCharFilter extends PreConfiguredAnalysisComponent<CharFilterFactory> {

    /**
     * Create a pre-configured char filter that may not vary at all.
     */
    public static PreConfiguredCharFilter singleton(String name, boolean useFilterForMultitermQueries, UnaryOperator<Reader> create) {
        return new PreConfiguredCharFilter(
            name,
            CachingStrategy.ONE,
            useFilterForMultitermQueries,
            (reader, version) -> create.apply(reader)
        );
    }

    /**
     * Create a pre-configured char filter that may not vary at all, provide access to the elasticsearch version
     */
    public static PreConfiguredCharFilter singletonWithVersion(String name, boolean useFilterForMultitermQueries,
            BiFunction<Reader, org.elasticsearch.Version, Reader> create) {
        return new PreConfiguredCharFilter(
            name,
            CachingStrategy.ONE,
            useFilterForMultitermQueries,
            (reader, version) -> create.apply(reader, version)
        );
    }

    /**
     * Create a pre-configured token filter that may vary based on the Lucene version.
     */
    public static PreConfiguredCharFilter luceneVersion(String name, boolean useFilterForMultitermQueries,
            BiFunction<Reader, org.apache.lucene.util.Version, Reader> create) {
        return new PreConfiguredCharFilter(
            name,
            CachingStrategy.LUCENE,
            useFilterForMultitermQueries,
            (reader, version) -> create.apply(reader, version.luceneVersion)
        );
    }

    /**
     * Create a pre-configured token filter that may vary based on the Elasticsearch version.
     */
    public static PreConfiguredCharFilter elasticsearchVersion(String name, boolean useFilterForMultitermQueries,
            BiFunction<Reader, org.elasticsearch.Version, Reader> create) {
        return new PreConfiguredCharFilter(name, CachingStrategy.ELASTICSEARCH, useFilterForMultitermQueries, create);
    }

    private final boolean useFilterForMultitermQueries;
    private final BiFunction<Reader, Version, Reader> create;

    protected PreConfiguredCharFilter(String name, CachingStrategy cache, boolean useFilterForMultitermQueries,
            BiFunction<Reader, org.elasticsearch.Version, Reader> create) {
        super(name, cache);
        this.useFilterForMultitermQueries = useFilterForMultitermQueries;
        this.create = create;
    }

    /**
     * Can this {@link TokenFilter} be used in multi-term queries?
     */
    public boolean shouldUseFilterForMultitermQueries() {
        return useFilterForMultitermQueries;
    }

    private interface MultiTermAwareCharFilterFactory extends CharFilterFactory, MultiTermAwareComponent {}

    @Override
    protected CharFilterFactory create(Version version) {<FILL_FUNCTION_BODY>}

}

        if (useFilterForMultitermQueries) {
            return new MultiTermAwareCharFilterFactory() {
                @Override
                public String name() {
                    return getName();
                }

                @Override
                public Reader create(Reader reader) {
                    return create.apply(reader, version);
                }

                @Override
                public Object getMultiTermComponent() {
                    return this;
                }
            };
        }
        return new CharFilterFactory() {
            @Override
            public Reader create(Reader reader) {
                return create.apply(reader, version);
            }

            @Override
            public String name() {
                return getName();
            }
        };
    
<methods>public org.elasticsearch.index.analysis.CharFilterFactory get(org.elasticsearch.index.IndexSettings, org.elasticsearch.env.Environment, java.lang.String, org.elasticsearch.common.settings.Settings) throws java.io.IOException,public java.lang.String getName() <variables>protected final non-sealed PreBuiltCache<org.elasticsearch.index.analysis.CharFilterFactory> cache,private final non-sealed java.lang.String name