Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2008, 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;
 
 import java.util.List;
 
 
A wrapper on a ConstructorInjectionPoint, to be used if a proxy subclass is instantiated instead of the original (e.g. because the original is an abstract javax.decorator.Decorator)

This class is immutable.

Author(s):
Marius Bogoevici
Ales Justin
Jozef Hartinger
 
 // TODO Needs equals/hashcode
 // TODO Would be clearer to make this either a wrapper or not
     private final boolean decorator;
     private final int delegateInjectionPointPosition;
     private final Bean<?> bean;
     private final String contextId;
 
     public ProxyClassConstructorInjectionPointWrapper(Bean<T> declaringBeanClass<?> declaringComponentClassEnhancedAnnotatedConstructor<T> weldConstructorConstructorInjectionPoint<T> originalConstructorInjectionPointBeanManagerImpl manager) {
         super(weldConstructordeclaringBeandeclaringComponentClass, InjectionPointFactory.silentInstance(), manager);
         this. = manager.getContextId();
         this. = (declaringBean instanceof javax.enterprise.inject.spi.Decorator);
         this. = originalConstructorInjectionPoint;
         this. = declaringBean;
     }
 
     private int initDelegateInjectionPointPosition() {
         for (ParameterInjectionPoint<?, T> parameter : getParameterInjectionPoints()) {
             if (parameter.isDelegate()) {
                 return parameter.getAnnotated().getPosition();
             }
         }
         return -1;
     }
 
     private boolean hasDelegateInjectionPoint() {
         return  != -1;
     }
 
     @Override
     }
 
     @Override
     protected T newInstance(Object[] parameterValues) {
         // Once the instance is created, a method handler is required regardless of whether
         // an actual bean instance is known yet.
         final T instance = super.newInstance(parameterValues);
         if () {
             BeanInstance beanInstance = null;
             if (hasDelegateInjectionPoint()) {
                 Object decoratorDelegate = parameterValues[];
                 beanInstance = new TargetBeanInstance(decoratorDelegate);
             }
             ProxyFactory.setBeanInstance(instancebeanInstance);
         } else {
             if (instance instanceof ProxyObject) {
                 ((ProxyObjectinstance).setHandler(new CombinedInterceptorAndDecoratorStackMethodHandler());
             }
         }
         return instance;
     }
 
    @Override
    }
    public int hashCode() {
        final int prime = 31;
        int result = super.hashCode();
        result = prime * result + (( == null) ? 0 : .hashCode());
        return result;
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!super.equals(obj)) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        if ( == null) {
            if (other.originalConstructorInjectionPoint != null) {
                return false;
            }
        } else if (!.equals(other.originalConstructorInjectionPoint)) {
            return false;
        }
        return true;
    }
New to GrepCode? Check out our FAQ X