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

org.hibernate.search.cfg.FieldBridgeDirectMapping 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.cfg;

import java.util.HashMap;
import java.util.Map;

import org.hibernate.search.bridge.FieldBridge;


/**
 * As opposed to FieldBridgeMapping which is used as an option of Field,
 * this mapping can be defined directly on the property.
 * Mostly used when no Field is defined, such as on DocumentId.
 *
 * @author Sanne Grinovero (C) 2012 Red Hat Inc.
 */
public class FieldBridgeDirectMapping extends PropertyMapping {

	private final Map fieldBridgeAnn = new HashMap();

	public FieldBridgeDirectMapping(PropertyDescriptor property, EntityDescriptor entity, SearchMapping mapping, Class fieldBridge) {
		super( property, entity, mapping );
		this.fieldBridgeAnn.put( "impl", fieldBridge );
		property.setFieldBridge( fieldBridgeAnn );
	}

	public FieldBridgeDirectMapping param(String name, String value) {
		Map param = SearchMapping.addElementToAnnotationArray( fieldBridgeAnn, "params" );
		param.put( "name", name );
		param.put( "value", value );
		return this;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy