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

com.guicedee.guicedservlets.jsf.FacesApplicationFactoryWrapper Maven / Gradle / Ivy

There is a newer version: 62
Show newest version
package com.guicedee.guicedservlets.jsf;

import com.google.inject.Key;
import com.guicedee.cdi.services.NamedBindings;
import com.guicedee.guicedinjection.GuiceContext;
import com.guicedee.guicedservlets.jsf.implementations.JsfNamedBinder;
import io.github.classgraph.ClassInfo;

import javax.faces.application.Application;
import javax.faces.application.ApplicationFactory;
import javax.faces.convert.FacesConverter;
import java.util.Map;

/**
 * An implementation of {@link ApplicationFactory}.
 *
 * @author John Yeary
 * @version 1.0
 */
public class FacesApplicationFactoryWrapper
		extends ApplicationFactory
{

	private ApplicationFactory factory;

	/**
	 * Constructor that wraps an {@link ApplicationFactory} instance.
	 *
	 * @param factory
	 * 		The factory instance to be wrapped.
	 */
	@SuppressWarnings("deprecation")
	public FacesApplicationFactoryWrapper(ApplicationFactory factory)
	{
		this.factory = factory;
	}

	/**
	 * {@inheritDoc}
	 * 

* This method returns a {@link FacesApplicationWrapper} instance.

*/ @Override public Application getApplication() { Application application = factory.getApplication(); NamedBindings.getConverters().forEach((key,value)->{ application.addConverter(key,value.getCanonicalName()); }); NamedBindings.getValidators().forEach((key,value)->{ application.addValidator(key,value.getCanonicalName()); }); return new FacesApplicationWrapper(application); } /** * {@inheritDoc} */ @Override public void setApplication(Application application) { factory.setApplication(application); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy