org.apache.webbeans.inject.InjectableMethod Maven / Gradle / Ivy
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.apache.webbeans.inject;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.spi.AnnotatedParameter;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.Producer;
import org.apache.webbeans.component.ProducerMethodBean;
import org.apache.webbeans.container.InjectionResolver;
import org.apache.webbeans.context.creational.CreationalContextImpl;
import org.apache.webbeans.exception.WebBeansException;
import org.apache.webbeans.proxy.NormalScopeProxyFactory;
import org.apache.webbeans.proxy.OwbNormalScopeProxy;
@SuppressWarnings("unchecked")
public class InjectableMethod extends AbstractInjectable
{
/** Injectable method */
protected Method method;
/** Bean parent instance that owns the method */
protected Object ownerInstance;
/**If this method is dispose method*/
private boolean disposable;
/**Used in dispose method, represents produces method parameter instance*/
private Object producerMethodInstance = null;
private Map, Object> dependentParameters = new HashMap, Object>();
private Set injectionPoints;
public InjectableMethod(Method m, Object instance, Producer owner, CreationalContextImpl creationalContext)
{
this(m, instance, owner, creationalContext, new HashSet(createInjectionPoints(owner, m)));
}
/**
* Constructs new instance.
*
* @param m injectable method
* @param instance component instance
*/
public InjectableMethod(Method m, Object instance, Producer owner, CreationalContextImpl creationalContext, Set ips)
{
super(owner,creationalContext);
method = m;
ownerInstance = instance;
injectionPoints = ips;
}
/*
* (non-Javadoc)
* @see org.apache.webbeans.inject.Injectable#doInjection()
*/
public T doInjection()
{
Object owner = ownerInstance;
if (owner instanceof OwbNormalScopeProxy)
{
owner = NormalScopeProxyFactory.unwrapInstance(owner);
}
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy