All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.search.analyzer.definition.impl.LuceneTokenizerDefinitionContextImpl Maven / Gradle / Ivy

There is a newer version: 5.11.12.Final
Show newest version
/*
 * Hibernate Search, full-text search for your domain model
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later
 * See the lgpl.txt file in the root directory or .
 */
package org.hibernate.search.analyzer.definition.impl;

import org.apache.lucene.analysis.util.TokenizerFactory;
import org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor;
import org.hibernate.annotations.common.annotationfactory.AnnotationFactory;
import org.hibernate.search.annotations.TokenizerDef;


/**
 * @author Yoann Rodiere
 */
public class LuceneTokenizerDefinitionContextImpl implements LuceneAnalysisDefinitionBuilder {

	private Class factoryClass;

	private final ParametersBuilder params = new ParametersBuilder();

	public void factory(Class factoryClass) {
		this.factoryClass = factoryClass;
	}

	public void param(String name, String value) {
		params.put( name, value );
	}

	@Override
	public TokenizerDef build() {
		AnnotationDescriptor descriptor = new AnnotationDescriptor( TokenizerDef.class );
		descriptor.setValue( "factory", factoryClass );
		descriptor.setValue( "params", params.build() );
		return AnnotationFactory.create( descriptor );
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy