Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2014, Red Hat, Inc., and individual contributors
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package org.jboss.weld.injection.producer;
 
 
 
Default org.jboss.weld.manager.api.WeldInjectionTargetBuilder implementation. The builder runs in a privileged context.

Parameters:
<T>
Author(s):
Jozef Hartinger
 
 
 
     private boolean resourceInjectionEnabled = true;
     private boolean targetClassLifecycleCallbacksEnabled = true;
     private boolean interceptorsEnabled = true;
     private boolean decorationEnabled = true;
     private Bean<T> bean;
 
     private final EnhancedAnnotatedType<T> type;
     private final BeanManagerImpl manager;
 
     public WeldInjectionTargetBuilderImpl(AnnotatedType<T> typeBeanManagerImpl manager) {
         this. = manager;
         this. = manager.getServices().get(ClassTransformer.class).getEnhancedAnnotatedType(typemanager.getId());
         this. = manager.getServices().get(InjectionTargetService.class);
     }
 
     @Override
     public WeldInjectionTargetBuilder<T> setResourceInjectionEnabled(boolean value) {
         this. = value;
         return this;
     }
 
     @Override
         this. = value;
         return this;
     }
 
     @Override
     public WeldInjectionTargetBuilder<T> setInterceptionEnabled(boolean value) {
         this. = value;
         return this;
     }
 
     @Override
     public WeldInjectionTargetBuilder<T> setDecorationEnabled(boolean value) {
         this. = value;
         return this;
     }
 
     @Override
     public WeldInjectionTargetBuilder<T> setBean(Bean<T> bean) {
         this. = bean;
         return this;
     }
 
     @Override
     public WeldInjectionTarget<T> build() {
         if (System.getSecurityManager() != null) {
             return AccessController.doPrivileged(this);
         }
         return run();
     }
 
     @Override
     public BasicInjectionTarget<T> run() {
         BasicInjectionTarget<T> injectionTarget = buildInternal();
         .validateProducer(injectionTarget);
        return injectionTarget;
    }
    private BasicInjectionTarget<T> buildInternal() {
        final Injector<T> injector = buildInjector();
        final LifecycleCallbackInvoker<T> invoker = buildInvoker();
        if (! && !) {
            return BasicInjectionTarget.create(injectorinvoker);
        } else if ( && ) {
            return new BeanInjectionTarget<T>(injectorinvoker);
        }
        throw new IllegalStateException("Unsupported combination: [interceptorsEnabled=" +  + ", decorationEnabled=" +  + "]");
    }
    private Injector<T> buildInjector() {
        if () {
            return ResourceInjector.of();
        } else {
            return DefaultInjector.of();
        }
    }
    private LifecycleCallbackInvoker<T> buildInvoker() {
            return DefaultLifecycleCallbackInvoker.of();
        } else {
            return NoopLifecycleCallbackInvoker.<T>getInstance();
        }
    }
    @Override
    public String toString() {
        return "WeldInjectionTargetBuilderImpl for " + ;
    }
New to GrepCode? Check out our FAQ X