You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by st...@apache.org on 2017/05/25 20:51:09 UTC
svn commit: r1796196 - in
/geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi:
./ configurator/
Author: struberg
Date: Thu May 25 20:51:08 2017
New Revision: 1796196
URL: http://svn.apache.org/viewvc?rev=1796196&view=rev
Log:
GERONIMO-6553 configurators continued
Added:
geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/configurator/ProducerConfigurator.java (with props)
Modified:
geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/DefinitionException.java
geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/DeploymentException.java
geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/ProcessAnnotatedType.java
geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/ProcessProducer.java
geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/configurator/BeanConfigurator.java
Modified: geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/DefinitionException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/DefinitionException.java?rev=1796196&r1=1796195&r2=1796196&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/DefinitionException.java (original)
+++ geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/DefinitionException.java Thu May 25 20:51:08 2017
@@ -28,10 +28,6 @@ public class DefinitionException extends
{
private static final long serialVersionUID = 1L;
- public DefinitionException()
- {
- }
-
public DefinitionException(Throwable cause)
{
super(cause);
Modified: geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/DeploymentException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/DeploymentException.java?rev=1796196&r1=1796195&r2=1796196&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/DeploymentException.java (original)
+++ geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/DeploymentException.java Thu May 25 20:51:08 2017
@@ -29,10 +29,6 @@ public class DeploymentException extends
{
private static final long serialVersionUID = 1L;
- public DeploymentException()
- {
- }
-
public DeploymentException(Throwable cause)
{
super(cause);
Modified: geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/ProcessAnnotatedType.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/ProcessAnnotatedType.java?rev=1796196&r1=1796195&r2=1796196&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/ProcessAnnotatedType.java (original)
+++ geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/ProcessAnnotatedType.java Thu May 25 20:51:08 2017
@@ -18,6 +18,8 @@
*/
package javax.enterprise.inject.spi;
+import javax.enterprise.inject.spi.configurator.AnnotatedTypeConfigurator;
+
/**
* Event is fired before reading any annotations on the class.
*
@@ -25,25 +27,27 @@ package javax.enterprise.inject.spi;
*
* <X> class type
*/
-public interface ProcessAnnotatedType<X>
+public interface ProcessAnnotatedType<BEANCLASS>
{
/**
* Gets annotated type.
*
* @return annotated type
*/
- AnnotatedType<X> getAnnotatedType();
+ AnnotatedType<BEANCLASS> getAnnotatedType();
/**
* Replaces annotated type.
*
* @param type annotated type
*/
- void setAnnotatedType(AnnotatedType<X> type);
+ void setAnnotatedType(AnnotatedType<BEANCLASS> type);
/**
* Veto registering process.
*/
void veto();
+
+ AnnotatedTypeConfigurator<BEANCLASS> configureAnnotatedType();
}
Modified: geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/ProcessProducer.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/ProcessProducer.java?rev=1796196&r1=1796195&r2=1796196&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/ProcessProducer.java (original)
+++ geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/ProcessProducer.java Thu May 25 20:51:08 2017
@@ -18,37 +18,39 @@
*/
package javax.enterprise.inject.spi;
+import javax.enterprise.inject.spi.configurator.ProducerConfigurator;
+
/**
* Container fires this event for each
* producer field/method including resources.
*
* @version $Rev$ $Date$
*
- * @param <X> bean class info
- * @param <T> producer return type
+ * @param <BEANCLASS> bean class info
+ * @param <RETURNTYPE> producer return type
*/
-public interface ProcessProducer<X, T>
+public interface ProcessProducer<BEANCLASS, RETURNTYPE>
{
/**
* Returns annotated member.
*
* @return annotated member
*/
- AnnotatedMember<X> getAnnotatedMember();
+ AnnotatedMember<BEANCLASS> getAnnotatedMember();
/**
* Returns producer instance.
*
* @return producer instance
*/
- Producer<T> getProducer();
+ Producer<RETURNTYPE> getProducer();
/**
* Replaces producer instance.
*
* @param producer new producer
*/
- void setProducer(Producer<T> producer);
+ void setProducer(Producer<RETURNTYPE> producer);
/**
* Adding definition error. Container aborts processing.
@@ -56,6 +58,13 @@ public interface ProcessProducer<X, T>
* @param t throwable
*/
void addDefinitionError(Throwable t);
+
+ /**
+ * This method can be used to tweak the underlying Producer currently processed.
+ *
+ * @return a ProducerConfigurator, initialised with the Producer of this event.
+ */
+ ProducerConfigurator<RETURNTYPE> configureProducer();
}
\ No newline at end of file
Modified: geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/configurator/BeanConfigurator.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/configurator/BeanConfigurator.java?rev=1796196&r1=1796195&r2=1796196&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/configurator/BeanConfigurator.java (original)
+++ geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/configurator/BeanConfigurator.java Thu May 25 20:51:08 2017
@@ -111,12 +111,12 @@ public interface BeanConfigurator<T> {
<U extends T> BeanConfigurator<U> createWith(Function<CreationalContext<U>, U> callback);
/**
- * A shortcut for {@code produceWith(() -> existing} where {@code existing} represents an instance whose lifecycle is not managed by CDI.
*
- * @param instance use as produced instance for the configured bean
+ *
+ * @param callback use as produced instance for the configured bean
* @return self
*/
- <U extends T> BeanConfigurator<U> producing(U instance);
+ <U extends T> BeanConfigurator<U> produceWith(Function<Instance<Object>, U> callback);
/**
*
Added: geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/configurator/ProducerConfigurator.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/configurator/ProducerConfigurator.java?rev=1796196&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/configurator/ProducerConfigurator.java (added)
+++ geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/configurator/ProducerConfigurator.java Thu May 25 20:51:08 2017
@@ -0,0 +1,46 @@
+/*
+ * 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 javax.enterprise.inject.spi.configurator;
+
+import javax.enterprise.inject.Instance;
+import java.util.function.Consumer;
+import java.util.function.Function;
+
+public interface ProducerConfigurator<T> {
+
+
+ /**
+ *
+ *
+ * @param callback use as produced instance for the configured bean
+ * @return self
+ */
+ <U extends T> ProducerConfigurator<U> produceWith(Function<Instance<Object>, U> callback);
+
+ /**
+ *
+ * Set a {@link Consumer} to destroy a bean instance.
+ * If no dispose callback is specified, a NOOP dispose callback is automatically set.
+ *
+ * @param callback the Consumer to dispose the instance
+ * @return self
+ */
+ ProducerConfigurator<T> disposeWith(Consumer<T> callback);
+}
Propchange: geronimo/specs/trunk/geronimo-jcdi_2.0_spec/src/main/java/javax/enterprise/inject/spi/configurator/ProducerConfigurator.java
------------------------------------------------------------------------------
svn:eol-style = native