Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.deephacks.tools4j.config.internal.core;
 
 
@SuppressWarnings(value = { "unchecked""rawtypes" })
public class ConfigCdiContext implements Context {
    private BeanManager bm;
    private RuntimeContext ctx;
    private CreationalContext cctx = null;
    private Map<ObjectObjectcache = new HashMap<>();
    public ConfigCdiContext(BeanManager bm) {
        this. = bm;
    }
    @Override
    public Class<? extends AnnotationgetScope() {
        return ConfigScope.class;
    }
    @Override
    public <T> T get(Contextual<T> contextualCreationalContext<T> creationalContext) {
        Bean<T> bean = (Bean<T>) contextual;
         = creationalContext;
        if ( == null) {
             = lookupRuntimeContext();
        }
        return (T) .singleton(bean.getBeanClass());
    }
    @Override
    public <T> T get(Contextual<T> contextual) {
        if ( == null) {
            return null;
        }
        if ( == null) {
             = lookupRuntimeContext();
        }
        Bean<T> bean = (Bean<T>) contextual;
        return (T) .singleton(bean.getBeanClass());
    }
    @Override
    public boolean isActive() {
        return true;
    }
    private RuntimeContext lookupRuntimeContext() {
        Set<Bean<?>> beans = .getBeans(RuntimeContext.class);
        Bean<?> bean = .resolve(beans);
        CreationalContext cc = .createCreationalContext(bean);
        return (RuntimeContext.getReference(beanRuntimeContext.classcc);
    }
New to GrepCode? Check out our FAQ X