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

com.github.ldeitos.validation.impl.interpolator.BaseInterpolator Maven / Gradle / Ivy

Go to download

Extension for BeanValidation API to provide CDI compatible ConstraintValidatorFactory, easy way to set parameters on message constraint and easy API to add non properties file message sources, like DB, external modules, mainframe routines, etc. This version is Java 17 and JakartaEE 10 compatible.

There is a newer version: 3.0
Show newest version
package com.github.ldeitos.validation.impl.interpolator;

import com.github.ldeitos.util.ManualContext;
import com.github.ldeitos.validation.MessagesSource;
import com.github.ldeitos.validation.impl.configuration.ConfigInfoProvider;
import com.github.ldeitos.validation.impl.configuration.Configuration;

class BaseInterpolator {

	/**
	 * Messages source.
	 */
	private MessagesSource messageSource;

	public MessagesSource getMessageSource() {
		ConfigInfoProvider configProvider = ManualContext.lookupCDI(ConfigInfoProvider.class);

		Configuration configuration = Configuration.getConfiguration(configProvider);
		if (messageSource == null) {
			messageSource = configuration.getConfiguredMessagesSource();
		}

		return messageSource;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy