You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by ge...@apache.org on 2009/01/28 23:51:45 UTC
svn commit: r738657 - in
/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans:
component/ config/ inject/ inject/impl/ intercept/ util/
Author: gerdogdu
Date: Wed Jan 28 22:51:44 2009
New Revision: 738657
URL: http://svn.apache.org/viewvc?rev=738657&view=rev
Log:
Adding InjectionPoint support for beans.
Added:
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java (with props)
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java (with props)
Modified:
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansScanner.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java?rev=738657&r1=738656&r2=738657&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java Wed Jan 28 22:51:44 2009
@@ -17,7 +17,6 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
import javax.context.CreationalContext;
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=738657&r1=738656&r2=738657&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java Wed Jan 28 22:51:44 2009
@@ -15,11 +15,13 @@
import java.io.Serializable;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import javax.annotation.Named;
@@ -34,6 +36,7 @@
import javax.inject.Specializes;
import javax.inject.UnsatisfiedDependencyException;
import javax.inject.manager.Bean;
+import javax.inject.manager.InjectionPoint;
import org.apache.webbeans.annotation.CurrentLiteral;
import org.apache.webbeans.annotation.DependentScopeLiteral;
@@ -48,6 +51,7 @@
import org.apache.webbeans.event.EventUtil;
import org.apache.webbeans.event.NotificationManager;
import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.inject.impl.InjectionPointFactory;
import org.apache.webbeans.intercept.WebBeansInterceptorConfig;
import org.apache.webbeans.intercept.ejb.EJBInterceptorConfig;
import org.apache.webbeans.util.AnnotationUtil;
@@ -57,9 +61,6 @@
/**
* Defines the web beans components common properties.
- *
- * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
- * @since 1.0
*/
public final class DefinitionUtil
{
@@ -371,6 +372,7 @@
if (newComponent != null)
{
producerComponents.add(newComponent);
+ addMethodInjectionPointMetaData(newComponent, declaredMethod);
}
}
}
@@ -452,6 +454,8 @@
}
pr.setDisposalMethod(declaredMethod);
+
+ addMethodInjectionPointMetaData(component, declaredMethod);
}
}
@@ -495,6 +499,7 @@
if (!Modifier.isStatic(mod) && !Modifier.isFinal(mod))
{
component.addInjectedField(field);
+ addFieldInjectionPointMetaData(component, field);
}
}
@@ -528,6 +533,7 @@
if (!Modifier.isStatic(method.getModifiers()))
{
component.addInjectedMethod(method);
+ addMethodInjectionPointMetaData(component, method);
}
}
@@ -555,6 +561,7 @@
WebBeansDecoratorConfig.configureDecarotors(component, object);
}
+ @SuppressWarnings("unchecked")
public static <T> void defineObserverMethods(ObservesMethodsOwner<T> component, Class<T> clazz)
{
Asserts.assertNotNull(component, "component parameter can not be null");
@@ -568,6 +575,8 @@
{
EventUtil.checkObserverMethodConditions(candidateMethod, clazz);
component.addObservableMethod(candidateMethod);
+
+ addMethodInjectionPointMetaData((AbstractComponent<T>)component, candidateMethod);
}
manager.addObservableComponentMethods(component);
@@ -582,4 +591,29 @@
component.setSerializable(true);
}
}
+
+ public static <T> void addFieldInjectionPointMetaData(AbstractComponent<T> owner, Field field)
+ {
+ InjectionPoint injectionPoint = InjectionPointFactory.getFieldInjectionPointData(owner, field);
+ owner.addInjectionPoint(injectionPoint);
+ }
+
+ public static <T> void addMethodInjectionPointMetaData(AbstractComponent<T> owner, Method method)
+ {
+ List<InjectionPoint> injectionPoints = InjectionPointFactory.getMethodInjectionPointData(owner, method);
+ for(InjectionPoint injectionPoint : injectionPoints)
+ {
+ owner.addInjectionPoint(injectionPoint);
+ }
+ }
+
+ public static <T> void addConstructorInjectionPointMetaData(AbstractComponent<T> owner, Constructor<T> constructor)
+ {
+ List<InjectionPoint> injectionPoints = InjectionPointFactory.getConstructorInjectionPointData(owner, constructor);
+ for(InjectionPoint injectionPoint : injectionPoints)
+ {
+ owner.addInjectionPoint(injectionPoint);
+ }
+ }
+
}
\ No newline at end of file
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java?rev=738657&r1=738656&r2=738657&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java Wed Jan 28 22:51:44 2009
@@ -14,6 +14,7 @@
package org.apache.webbeans.config;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
import java.util.Set;
import javax.context.ScopeType;
@@ -36,9 +37,6 @@
* <p>
* Contains useful static methods for creating simple web beans.
* </p>
- *
- * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
- * @since 1.0
*/
public final class SimpleWebBeansConfigurator
{
@@ -104,8 +102,7 @@
*
* @param clazz simple web bean implementation class
* @return the newly simple web bean component
- * @throws WebBeansConfigurationException if any configuration exception
- * occurs
+ * @throws WebBeansConfigurationException if any configuration exception occurs
*/
public static <T> ComponentImpl<T> define(Class<T> clazz, WebBeansType type) throws WebBeansConfigurationException
{
@@ -132,7 +129,9 @@
DefinitionUtil.defineBindingTypes(component, clazzAnns);
DefinitionUtil.defineName(component, clazzAnns, WebBeansUtil.getSimpleWebBeanDefaultName(clazz.getSimpleName()));
- component.setConstructor(WebBeansUtil.defineConstructor(clazz));
+ Constructor<T> constructor = WebBeansUtil.defineConstructor(clazz);
+ component.setConstructor(constructor);
+ DefinitionUtil.addConstructorInjectionPointMetaData(component, constructor);
WebBeansUtil.checkSteroTypeRequirements(component, clazz.getAnnotations(), "WebBeans component class : " + clazz.getName());
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java?rev=738657&r1=738656&r2=738657&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java Wed Jan 28 22:51:44 2009
@@ -46,11 +46,8 @@
import org.apache.webbeans.xml.XMLSpecializesManager;
/**
- * Deploys the all components that are defined in the {@link WebBeansScanner} at
+ * Deploys the all beans that are defined in the {@link WebBeansScanner} at
* the scanner phase.
- *
- * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
- * @since 1.0
*/
@SuppressWarnings("unchecked")
public final class WebBeansContainerDeployer
@@ -118,6 +115,7 @@
// Start from the class
Map<String, Set<String>> classIndex = scanner.getANNOTATION_DB().getClassIndex();
+
if (classIndex != null)
{
Set<String> pathClasses = classIndex.keySet();
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansScanner.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansScanner.java?rev=738657&r1=738656&r2=738657&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansScanner.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansScanner.java Wed Jan 28 22:51:44 2009
@@ -31,15 +31,7 @@
import org.scannotation.WarUrlFinder;
/**
- * Configures the <b>Web Beans Container</b> at the enterprise application
- * deployment time.
- * <p>
- * See the web beans specification section-10 for further details of how to
- * configure web beans container.
- * </p>
- *
- * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
- * @since 1.0
+ * Configures the web application to find beans.
*/
public final class WebBeansScanner
{
@@ -48,8 +40,7 @@
/** Location of the beans.xml files. */
private Map<String, InputStream> WEBBEANS_XML_LOCATIONS = new HashMap<String, InputStream>();
- /** Location of the ejb-jar.xml files */
- private Map<String, InputStream> EJB_XML_LOCATIONS = new HashMap<String, InputStream>();
+ //private Map<String, InputStream> EJB_XML_LOCATIONS = new HashMap<String, InputStream>();
/** Annotation Database */
private AnnotationDB ANNOTATION_DB = null;
@@ -153,38 +144,39 @@
}
listURL.add(url);
+
WEBBEANS_XML_LOCATIONS.put(addPath.getFile(), addPath.openStream());
}
}
// Scan for ejb-jar.xml
- URL[] ejbUrls = ClasspathUrlFinder.findResourceBases("META-INF/ejb-jar.xml", WebBeansUtil.getCurrentClassLoader());
-
- if (ejbUrls != null && ejbUrls.length > 0)
- {
- for (URL ejbUrl : ejbUrls)
- {
- // ok, beans.xml and ejb-jar.xml is in the same root
- if (listURL.contains(ejbUrl))
- {
- URL addPath = null;
-
- String fileDir = ejbUrl.getFile();
-
- if (fileDir.endsWith(".jar!/"))
- {
- fileDir = fileDir.substring(0, fileDir.lastIndexOf("/")) + "/META-INF/ejb-jar.xml";
- addPath = new URL("jar:" + fileDir);
- }
- else
- {
- addPath = new URL("file:" + ejbUrl.getFile() + "META-INF/ejb-jar.xml");
- }
-
- EJB_XML_LOCATIONS.put(addPath.getFile(), addPath.openStream());
- }
- }
- }
+// URL[] ejbUrls = ClasspathUrlFinder.findResourceBases("META-INF/ejb-jar.xml", WebBeansUtil.getCurrentClassLoader());
+//
+// if (ejbUrls != null && ejbUrls.length > 0)
+// {
+// for (URL ejbUrl : ejbUrls)
+// {
+// // ok, beans.xml and ejb-jar.xml is in the same root
+// if (listURL.contains(ejbUrl))
+// {
+// URL addPath = null;
+//
+// String fileDir = ejbUrl.getFile();
+//
+// if (fileDir.endsWith(".jar!/"))
+// {
+// fileDir = fileDir.substring(0, fileDir.lastIndexOf("/")) + "/META-INF/ejb-jar.xml";
+// addPath = new URL("jar:" + fileDir);
+// }
+// else
+// {
+// addPath = new URL("file:" + ejbUrl.getFile() + "META-INF/ejb-jar.xml");
+// }
+//
+// EJB_XML_LOCATIONS.put(addPath.getFile(), addPath.openStream());
+// }
+// }
+// }
return listURL;
}
@@ -220,10 +212,10 @@
*
* @return list of stream
*/
- public Map<String, InputStream> getEJB_XML_LOCATIONS()
- {
- return EJB_XML_LOCATIONS;
- }
+// public Map<String, InputStream> getEJB_XML_LOCATIONS()
+// {
+// return EJB_XML_LOCATIONS;
+// }
/**
* Gets annotated classes.
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java?rev=738657&r1=738656&r2=738657&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java Wed Jan 28 22:51:44 2009
@@ -53,7 +53,9 @@
Annotation[] annots = field.getAnnotations();
Annotation[] bindingAnnos = AnnotationUtil.getBindingAnnotations(annots);
- Annotation[] resourceAnnos = AnnotationUtil.getResourceAnnotations(annots);
+
+ //GE : Mark this is not used! I am commenting here!
+ //Annotation[] resourceAnnos = AnnotationUtil.getResourceAnnotations(annots);
try
{
Added: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java?rev=738657&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java Wed Jan 28 22:51:44 2009
@@ -0,0 +1,156 @@
+/*
+ * 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.impl;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.event.Observes;
+import javax.inject.manager.Bean;
+import javax.inject.manager.InjectionPoint;
+
+import org.apache.webbeans.annotation.CurrentLiteral;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.Asserts;
+
+public class InjectionPointFactory
+{
+
+ public static InjectionPoint getFieldInjectionPointData(Bean<?> owner, Field member)
+ {
+ Asserts.assertNotNull(owner, "owner parameter can not be null");
+ Asserts.assertNotNull(member, "member parameter can not be null");
+
+ Annotation[] annots = null;
+ annots = member.getAnnotations();
+
+ return getGenericInjectionPoint(owner, annots, member.getGenericType(), member);
+ }
+
+ private static InjectionPoint getGenericInjectionPoint(Bean<?> owner, Annotation[] annots, Type type, Member member)
+ {
+ InjectionPointImpl injectionPoint = null;
+
+ Annotation[] bindingAnnots = AnnotationUtil.getBindingAnnotations(annots);
+
+ injectionPoint = new InjectionPointImpl(owner, type, member);
+
+ addAnnotation(injectionPoint, annots, false);
+ addAnnotation(injectionPoint, bindingAnnots, true);
+
+ return injectionPoint;
+
+ }
+
+ public static List<InjectionPoint> getMethodInjectionPointData(Bean<?> owner, Method member)
+ {
+ Asserts.assertNotNull(owner, "owner parameter can not be null");
+ Asserts.assertNotNull(member, "member parameter can not be null");
+
+ List<InjectionPoint> lists = new ArrayList<InjectionPoint>();
+
+ Type[] types = member.getGenericParameterTypes();
+ Annotation[][] annots = member.getParameterAnnotations();
+
+ if (types.length > 0)
+ {
+ int i = 0;
+
+ boolean observesAnnotation = false;
+ for (Type type : types)
+ {
+ Annotation[] annot = annots[i];
+
+ if (annot.length == 0)
+ {
+ annot = new Annotation[1];
+ annot[0] = new CurrentLiteral();
+ }
+
+ for (Annotation observersAnnot : annot)
+ {
+ if (observersAnnot.annotationType().equals(Observes.class))
+ {
+ observesAnnotation = true;
+ break;
+ }
+ }
+
+ if (!observesAnnotation)
+ {
+ lists.add(getGenericInjectionPoint(owner, annot, type, member));
+ }
+
+ i++;
+ }
+ }
+
+ return lists;
+ }
+
+ public static List<InjectionPoint> getConstructorInjectionPointData(Bean<?> owner, Constructor<?> member)
+ {
+ Asserts.assertNotNull(owner, "owner parameter can not be null");
+ Asserts.assertNotNull(member, "member parameter can not be null");
+
+ List<InjectionPoint> lists = new ArrayList<InjectionPoint>();
+
+ Type[] types = member.getGenericParameterTypes();
+ Annotation[][] annots = member.getParameterAnnotations();
+
+ if (types.length > 0)
+ {
+ int i = 0;
+
+ for (Type type : types)
+ {
+ Annotation[] annot = annots[i];
+
+ if (annot.length == 0)
+ {
+ annot = new Annotation[1];
+ annot[0] = new CurrentLiteral();
+ }
+
+ lists.add(getGenericInjectionPoint(owner, annot, type, member));
+
+ i++;
+ }
+ }
+
+ return lists;
+ }
+
+ private static void addAnnotation(InjectionPointImpl impl, Annotation[] annots, boolean isBinding)
+ {
+ for (Annotation ann : annots)
+ {
+ if (isBinding)
+ {
+ impl.addBindingAnnotation(ann);
+ }
+ else
+ {
+ impl.addAnnotation(ann);
+ }
+ }
+ }
+
+}
Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java?rev=738657&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java Wed Jan 28 22:51:44 2009
@@ -0,0 +1,118 @@
+/*
+ * 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.impl;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.inject.manager.Bean;
+import javax.inject.manager.InjectionPoint;
+
+class InjectionPointImpl implements InjectionPoint
+{
+ private Set<Annotation> bindingAnnotations = new HashSet<Annotation>();
+
+ private Set<Annotation> annotations = new HashSet<Annotation>();
+
+ private Bean<?> ownerBean;
+
+ private Member injectionMember;
+
+ private Type injectionType;
+
+ InjectionPointImpl(Bean<?> ownerBean, Type type, Member member)
+ {
+ this.ownerBean = ownerBean;
+ this.injectionMember = member;
+ this.injectionType = type;
+ }
+
+ void addBindingAnnotation(Annotation bindingannotation)
+ {
+ this.bindingAnnotations.add(bindingannotation);
+ }
+
+ void addAnnotation(Annotation annotation)
+ {
+ this.annotations.add(annotation);
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+ {
+
+ for(Annotation ann : this.annotations)
+ {
+ if(ann.annotationType().equals(annotationType))
+ {
+ return (T)ann;
+ }
+ }
+
+ return null;
+ }
+
+ public Annotation[] getAnnotations()
+ {
+ Annotation[] ann = new Annotation[this.annotations.size()];
+ ann = this.annotations.toArray(ann);
+
+ return ann;
+ }
+
+ public Bean<?> getBean()
+ {
+
+ return this.ownerBean;
+ }
+
+ public Set<Annotation> getBindings()
+ {
+
+ return this.bindingAnnotations;
+ }
+
+ public Member getMember()
+ {
+
+ return this.injectionMember;
+ }
+
+ public Type getType()
+ {
+
+ return this.injectionType;
+ }
+
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ for(Annotation ann : this.annotations)
+ {
+ if(ann.annotationType().equals(annotationType))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+}
\ No newline at end of file
Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java?rev=738657&r1=738656&r2=738657&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java Wed Jan 28 22:51:44 2009
@@ -49,6 +49,7 @@
this.component = component;
}
+ @SuppressWarnings("unchecked")
public Object invoke(Object instance, Method method, Method proceed, Object[] arguments) throws Exception
{
Context webbeansContext = ManagerImpl.getManager().getContext(component.getScopeType());
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=738657&r1=738656&r2=738657&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java Wed Jan 28 22:51:44 2009
@@ -1412,6 +1412,6 @@
{
throw new IllegalArgumentException("scopeType argument must be annotated with @ScopeType");
}
-
}
-}
\ No newline at end of file
+
+ }
\ No newline at end of file