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

org.hibernate.boot.registry.selector.SimpleStrategyRegistrationImpl Maven / Gradle / Ivy

There is a newer version: 6.5.0.CR2
Show newest version
/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * 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.boot.registry.selector;

import java.util.Arrays;

/**
 * A simple implementation of StrategyRegistration.
 *
 * @param  The strategy type.
 *
 * @author Steve Ebersole
 */
public class SimpleStrategyRegistrationImpl implements StrategyRegistration {
	private final Class strategyRole;
	private final Class strategyImplementation;
	private final Iterable selectorNames;

	/**
	 * Constructs a SimpleStrategyRegistrationImpl.
	 *
	 * @param strategyRole The strategy contract
	 * @param strategyImplementation The strategy implementation class
	 * @param selectorNames The selection/registration names for this implementation
	 */
	public SimpleStrategyRegistrationImpl(
			Class strategyRole,
			Class strategyImplementation,
			Iterable selectorNames) {
		this.strategyRole = strategyRole;
		this.strategyImplementation = strategyImplementation;
		this.selectorNames = selectorNames;
	}

	/**
	 * Constructs a SimpleStrategyRegistrationImpl.
	 *
	 * @param strategyRole The strategy contract
	 * @param strategyImplementation The strategy implementation class
	 * @param selectorNames The selection/registration names for this implementation
	 */
	public SimpleStrategyRegistrationImpl(
			Class strategyRole,
			Class strategyImplementation,
			String... selectorNames) {
		this( strategyRole, strategyImplementation, Arrays.asList( selectorNames ) );
	}

	@Override
	public Class getStrategyRole() {
		return strategyRole;
	}

	@Override
	public Iterable getSelectorNames() {
		return selectorNames;
	}

	@Override
	public Class getStrategyImplementation() {
		return strategyImplementation;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy