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/17 16:13:36 UTC
svn commit: r735301 - in
/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans:
component/ config/ container/ decorator/ deployment/ inject/
intercept/webbeans/ util/
Author: gerdogdu
Date: Sat Jan 17 07:13:36 2009
New Revision: 735301
URL: http://svn.apache.org/viewvc?rev=735301&view=rev
Log:
Adapting to the new interfaces.
Modified:
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/Component.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/container/ManagerImpl.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java?rev=735301&r1=735300&r2=735301&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java Sat Jan 17 07:13:36 2009
@@ -24,6 +24,7 @@
import javax.webbeans.CreationException;
import javax.webbeans.Dependent;
+import javax.webbeans.InjectionPoint;
import javax.webbeans.manager.Bean;
import org.apache.webbeans.container.ManagerImpl;
@@ -45,7 +46,6 @@
* {@link AbstractComponent#destroyInstance(Object)} methods.
* </p>
*
- * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
* @since 1.0
*/
public abstract class AbstractComponent<T> extends Component<T>
@@ -91,6 +91,8 @@
/** The bean allows nullable object */
protected boolean nullable = true;
+
+ protected Set<InjectionPoint> injectionPoints = new HashSet<InjectionPoint>();
/**
* Constructor definiton. Each subclass redefines its own constructor with
@@ -465,5 +467,15 @@
bean.destroy(instance);
}
}
+
+ public void addInjectionPoint(InjectionPoint injectionPoint)
+ {
+ this.injectionPoints.add(injectionPoint);
+ }
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return this.injectionPoints;
+ }
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/Component.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/Component.java?rev=735301&r1=735300&r2=735301&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/Component.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/Component.java Sat Jan 17 07:13:36 2009
@@ -17,6 +17,7 @@
import java.util.List;
import java.util.Set;
+import javax.webbeans.InjectionPoint;
import javax.webbeans.manager.Bean;
import javax.webbeans.manager.Manager;
@@ -55,6 +56,8 @@
abstract public void addStereoType(Annotation stereoType);
abstract public void addApiType(Class<?> apiType);
+
+ abstract public void addInjectionPoint(InjectionPoint injectionPoint);
abstract public Set<Annotation> getImplBindingTypes();
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=735301&r1=735300&r2=735301&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 Sat Jan 17 07:13:36 2009
@@ -130,13 +130,26 @@
*/
public static <T> void defineProducerMethodApiTypes(AbstractComponent<T> component, Class<T> clazz)
{
+ Set<Class<?>> types = component.getTypes();
+
if (clazz.isPrimitive() || clazz.isArray())
{
- component.getTypes().add(clazz);
- component.getTypes().add(Object.class);
+ types.add(clazz);
+ types.add(Object.class);
+
+ if(clazz.isPrimitive())
+ {
+ types.add(ClassUtil.getPrimitiveWrapper(clazz));
+ }
+
}
else
{
+ if(ClassUtil.isPrimitiveWrapper(clazz))
+ {
+ types.add(ClassUtil.getWrapperPrimitive(clazz));
+ }
+
ClassUtil.setTypeHierarchy(component.getTypes(), clazz);
}
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java?rev=735301&r1=735300&r2=735301&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java Sat Jan 17 07:13:36 2009
@@ -63,7 +63,6 @@
* Implementation of the {@link WebBeansManager} contract of the web beans
* container.
*
- * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
* @since 1.0
* @see java.webbeans.WebBeansManager
*/
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java?rev=735301&r1=735300&r2=735301&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java Sat Jan 17 07:13:36 2009
@@ -21,6 +21,7 @@
import java.util.Set;
import javax.webbeans.Decorates;
+import javax.webbeans.InjectionPoint;
import javax.webbeans.manager.Decorator;
import org.apache.webbeans.component.AbstractComponent;
@@ -266,6 +267,11 @@
{
return delegateComponent;
}
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return delegateComponent.getInjectionPoints();
+ }
/**
* @return the clazz
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java?rev=735301&r1=735300&r2=735301&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java Sat Jan 17 07:13:36 2009
@@ -57,7 +57,6 @@
setName(name);
}
- @SuppressWarnings("unchecked")
private void configure(Element stereoTypeDecleration, String errorMessage)
{
List<Element> childs = stereoTypeDecleration.elements();
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java?rev=735301&r1=735300&r2=735301&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java Sat Jan 17 07:13:36 2009
@@ -40,7 +40,6 @@
* @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
* @since 1.0
*/
-@SuppressWarnings("unchecked")
public abstract class AbstractInjectable implements Injectable
{
/** Owner component */
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java?rev=735301&r1=735300&r2=735301&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java Sat Jan 17 07:13:36 2009
@@ -23,6 +23,7 @@
import java.util.Map;
import java.util.Set;
+import javax.webbeans.InjectionPoint;
import javax.webbeans.InterceptorBindingType;
import javax.webbeans.NonBinding;
import javax.webbeans.manager.InterceptionType;
@@ -308,6 +309,12 @@
{
return delegateComponent.getTypes();
}
+
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return delegateComponent.getInjectionPoints();
+ }
/*
* (non-Javadoc)
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java?rev=735301&r1=735300&r2=735301&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java Sat Jan 17 07:13:36 2009
@@ -51,19 +51,16 @@
@SuppressWarnings("unchecked")
public final class ClassUtil
{
- public static Map<Class<?>, Object> PRIMITIVE_CLASS_DEFAULT_VALUES = null;
+ public static final Map<Class<?>, Object> PRIMITIVE_CLASS_DEFAULT_VALUES = new HashMap<Class<?>, Object>();;
- public static Set<Class<?>> VALUE_TYPES = new HashSet<Class<?>>();
+ public static final Set<Class<?>> VALUE_TYPES = new HashSet<Class<?>>();
- public static Set<Class<?>> PRIMITIVE_WRAPPERS = new HashSet<Class<?>>();
-
- public static Set<Class<?>> PRIMITIVES = new HashSet<Class<?>>();
+ public static final Map<Class<?>, Class<?>> PRIMITIVE_TO_WRAPPERS_MAP = new HashMap<Class<?>, Class<?>>();
public static final String WEBBEANS_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZ";
static
- {
- PRIMITIVE_CLASS_DEFAULT_VALUES = new HashMap<Class<?>, Object>();
+ {
PRIMITIVE_CLASS_DEFAULT_VALUES.put(Integer.class, Integer.MIN_VALUE);
PRIMITIVE_CLASS_DEFAULT_VALUES.put(Float.class, Float.MIN_VALUE);
PRIMITIVE_CLASS_DEFAULT_VALUES.put(Double.class, Double.MIN_VALUE);
@@ -87,25 +84,15 @@
VALUE_TYPES.add(Timestamp.class);
VALUE_TYPES.add(BigDecimal.class);
VALUE_TYPES.add(BigInteger.class);
-
- PRIMITIVES.add(Integer.TYPE);
- PRIMITIVES.add(Float.TYPE);
- PRIMITIVES.add(Double.TYPE);
- PRIMITIVES.add(Character.TYPE);
- PRIMITIVES.add(Long.TYPE);
- PRIMITIVES.add(Byte.TYPE);
- PRIMITIVES.add(Short.TYPE);
- PRIMITIVES.add(Boolean.TYPE);
-
- PRIMITIVE_WRAPPERS.add(Integer.class);
- PRIMITIVE_WRAPPERS.add(Float.class);
- PRIMITIVE_WRAPPERS.add(Double.class);
- PRIMITIVE_WRAPPERS.add(Character.class);
- PRIMITIVE_WRAPPERS.add(Long.class);
- PRIMITIVE_WRAPPERS.add(Byte.class);
- PRIMITIVE_WRAPPERS.add(Short.class);
- PRIMITIVE_WRAPPERS.add(Boolean.class);
-
+
+ PRIMITIVE_TO_WRAPPERS_MAP.put(Integer.TYPE,Integer.class);
+ PRIMITIVE_TO_WRAPPERS_MAP.put(Float.TYPE,Float.class);
+ PRIMITIVE_TO_WRAPPERS_MAP.put(Double.TYPE,Double.class);
+ PRIMITIVE_TO_WRAPPERS_MAP.put(Character.TYPE,Character.class);
+ PRIMITIVE_TO_WRAPPERS_MAP.put(Long.TYPE,Long.class);
+ PRIMITIVE_TO_WRAPPERS_MAP.put(Byte.TYPE,Byte.class);
+ PRIMITIVE_TO_WRAPPERS_MAP.put(Short.TYPE,Short.class);
+ PRIMITIVE_TO_WRAPPERS_MAP.put(Boolean.TYPE,Boolean.class);
}
/*
@@ -338,6 +325,31 @@
return null;
}
+
+ public static Class<?> getPrimitiveWrapper(Class<?> clazz)
+ {
+ Asserts.nullCheckForClass(clazz);
+
+ return PRIMITIVE_TO_WRAPPERS_MAP.get(clazz);
+
+ }
+
+ public static Class<?> getWrapperPrimitive(Class<?> clazz)
+ {
+ Asserts.nullCheckForClass(clazz);
+
+ Set<Class<?>> keySet = PRIMITIVE_TO_WRAPPERS_MAP.keySet();
+
+ for(Class<?> key : keySet)
+ {
+ if(PRIMITIVE_TO_WRAPPERS_MAP.get(key).equals(clazz))
+ {
+ return key;
+ }
+ }
+
+ return null;
+ }
/**
* Gets the class of the given type arguments.
@@ -912,7 +924,7 @@
{
Asserts.nullCheckForClass(clazz);
- return PRIMITIVE_WRAPPERS.contains(clazz);
+ return PRIMITIVE_TO_WRAPPERS_MAP.containsValue(clazz);
}
@@ -934,7 +946,7 @@
if (!result)
{
- result = PRIMITIVES.contains(clazz);
+ result = clazz.isPrimitive();
}
if (!result)
@@ -1306,4 +1318,5 @@
return found;
}
+
}