
com.vaadin.cdi.internal.VaadinContextualStorage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vaadin-cdi Show documentation
Show all versions of vaadin-cdi Show documentation
Provides CDI integration for Vaadin projects
package com.vaadin.cdi.internal;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.PassivationCapable;
import org.apache.deltaspike.core.util.context.ContextualStorage;
/**
* Customized version of ContextualStorage to also handle beans that are not
* PassivationCapable. Such beans are used as their own keys, which is not ideal
* but should work in most single-JVM environments.
*
* @see ContextualStorage
*/
public class VaadinContextualStorage extends ContextualStorage {
public VaadinContextualStorage(BeanManager beanManager, boolean concurrent) {
super(beanManager, concurrent, true);
}
@Override
public Object getBeanKey(Contextual bean) {
if(bean instanceof PassivationCapable) {
return super.getBeanKey(bean);
} else {
return bean;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy