geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1796175 - in /geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject: Instance.java spi/AfterTypeDiscovery.java spi/AnnotatedType.java
Date Thu, 25 May 2017 16:54:22 GMT
Author: struberg
Date: Thu May 25 16:54:22 2017
New Revision: 1796175

URL: http://svn.apache.org/viewvc?rev=1796175&view=rev
Log:
GERONIMO-6553 more cdi 2.0 fixes

Modified:
    geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/Instance.java
    geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/AfterTypeDiscovery.java
    geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/AnnotatedType.java

Modified: geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/Instance.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/Instance.java?rev=1796175&r1=1796174&r2=1796175&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/Instance.java
(original)
+++ geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/Instance.java
Thu May 25 16:54:22 2017
@@ -19,6 +19,8 @@
 package javax.enterprise.inject;
 
 import java.lang.annotation.Annotation;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
 
 import javax.enterprise.util.TypeLiteral;
 import javax.inject.Provider;
@@ -77,6 +79,27 @@ public interface Instance<T> extends Ite
     boolean isAmbiguous();
 
     /**
+     * @return {@code true} if there is exactly one {@link javax.enterprise.inject.spi.Bean}
+     *      which resolves according to the currently selected type and qualifiers.
+     *      In other words: whether the Instance can serve an actual Contextual Reference.
+     *
+     * @since 2.0
+     */
+    default boolean isResolvable()
+    {
+        return !isAmbiguous() && !isUnsatisfied();
+    }
+
+    /**
+     * @return a Stream of all the beans available for the currently selected type and qualifiers,
+     *      or an empty Stream if {@link #isUnsatisfied()}
+     */
+    default Stream<T> stream()
+    {
+        return StreamSupport.stream(spliterator(), false);
+    }
+
+    /**
      * Destroy the given Contextual Instance.
      * This is especially intended for {@link javax.enterprise.context.Dependent} scoped
beans
      * which might otherwise create mem leaks.
@@ -84,4 +107,5 @@ public interface Instance<T> extends Ite
      */
     void destroy(T instance);
 
+
 }

Modified: geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/AfterTypeDiscovery.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/AfterTypeDiscovery.java?rev=1796175&r1=1796174&r2=1796175&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/AfterTypeDiscovery.java
(original)
+++ geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/AfterTypeDiscovery.java
Thu May 25 16:54:22 2017
@@ -78,10 +78,10 @@ public interface AfterTypeDiscovery
     /**
      * Returns a new annotated type configurator based on a new bean id and bean class.
      *
+     * @param clazz to add
      * @param id of the annotated type
-     * @param clazz
      * @param <T>
      * @return
      */
-    <T> AnnotatedTypeConfigurator<T> addAnnotatedType(String id, Class<T>
clazz);
+    <T> AnnotatedTypeConfigurator<T> addAnnotatedType(Class<T> clazz, String
id);
 }

Modified: geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/AnnotatedType.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/AnnotatedType.java?rev=1796175&r1=1796174&r2=1796175&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/AnnotatedType.java
(original)
+++ geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/AnnotatedType.java
Thu May 25 16:54:22 2017
@@ -18,7 +18,6 @@
  */
 package javax.enterprise.inject.spi;
 
-import javax.enterprise.inject.spi.configurator.AnnotatedTypeConfigurator;
 import java.lang.annotation.Annotation;
 import java.util.Arrays;
 import java.util.LinkedHashSet;
@@ -59,12 +58,6 @@ public interface AnnotatedType<X> extend
      */
     Set<AnnotatedField<? super X>> getFields();
 
-   /**
-    * Creates a configurator to configure this annotated type.
-    * @return
-    */
-    AnnotatedTypeConfigurator<X> configureAnnotatedType();
-
     @Override
     default <T extends Annotation> Set<T> getAnnotations(Class<T> annotationType)
     {



Mime
View raw message