package inc.monsters.mias.extval;

import org.apache.myfaces.extensions.validator.baseval.annotation.Pattern;
import org.apache.myfaces.extensions.validator.core.ExtValContext;
import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationNames;
import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticInMemoryConfiguration;
import org.apache.myfaces.extensions.validator.core.startup.AbstractStartupListener;

public class PatternOrStartupListener extends AbstractStartupListener {

	private static final long serialVersionUID = 5903779316252870082L;

	@Override
	protected void init() {
		StaticInMemoryConfiguration config = new StaticInMemoryConfiguration();
        config.addMapping(Pattern.class.getName(), PatternOrValidationStrategy.class.getName());
        ExtValContext.getContext().addStaticConfiguration(StaticConfigurationNames.META_DATA_TO_VALIDATION_STRATEGY_CONFIG, config);
	}

}
