commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joc...@apache.org
Subject svn commit: r1646221 - in /commons/sandbox/commons-inject/trunk: ./ src/main/java/org/apache/commons/inject/api/ src/main/java/org/apache/commons/inject/api/bind/ src/main/java/org/apache/commons/inject/impl/ src/main/java/org/apache/commons/inject/imp...
Date Wed, 17 Dec 2014 12:48:20 GMT
Author: jochen
Date: Wed Dec 17 12:48:19 2014
New Revision: 1646221

URL: http://svn.apache.org/r1646221
Log:
- Removing Guice as a dependency.
- Adding Javadocs.

Modified:
    commons/sandbox/commons-inject/trunk/pom.xml
    commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/IKey.java
    commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/ILifecycleController.java
    commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/ILifecycleListener.java
    commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/IPoint.java
    commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/IProvider.java
    commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/InjLogger.java
    commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/Key.java
    commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/bind/ILinkedBindingBuilder.java
    commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/impl/AbstractScopedProvider.java
    commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/impl/bind/DefaultBindingBuilder.java
    commons/sandbox/commons-inject/trunk/src/site/apt/index.apt

Modified: commons/sandbox/commons-inject/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/commons-inject/trunk/pom.xml?rev=1646221&r1=1646220&r2=1646221&view=diff
==============================================================================
--- commons/sandbox/commons-inject/trunk/pom.xml (original)
+++ commons/sandbox/commons-inject/trunk/pom.xml Wed Dec 17 12:48:19 2014
@@ -148,11 +148,6 @@
   		<scope>test</scope>
   	</dependency>
   	<dependency>
-  		<groupId>com.google.inject</groupId>
-  		<artifactId>guice</artifactId>
-  		<version>4.0-beta5</version>
-  	</dependency>
-  	<dependency>
   		<groupId>log4j</groupId>
   		<artifactId>log4j</artifactId>
   		<version>1.2.17</version>

Modified: commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/IKey.java
URL: http://svn.apache.org/viewvc/commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/IKey.java?rev=1646221&r1=1646220&r2=1646221&view=diff
==============================================================================
--- commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/IKey.java
(original)
+++ commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/IKey.java
Wed Dec 17 12:48:19 2014
@@ -19,7 +19,8 @@ package org.apache.commons.inject.api;
 import java.lang.annotation.Annotation;
 
 /**
- * A binding key is used to query objects
+ * Binding key consisting of an injection type and an optional annotation.
+ * Matches the type and annotation at a point of injection.
  */
 public interface IKey<T> {
 	Class<T> getType();

Modified: commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/ILifecycleController.java
URL: http://svn.apache.org/viewvc/commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/ILifecycleController.java?rev=1646221&r1=1646220&r2=1646221&view=diff
==============================================================================
--- commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/ILifecycleController.java
(original)
+++ commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/ILifecycleController.java
Wed Dec 17 12:48:19 2014
@@ -16,6 +16,18 @@
 */
 package org.apache.commons.inject.api;
 
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+
+/**
+ * Interface of an object, which is used by the {@link PostConstructModule}.
+ * The module adds binding listeners, which ensure that objects annotated
+ * with {@link PostConstruct}, or {@link PreDestroy}, are being added to
+ * the lifecycle listener via {@link #add(ILifecycleListener)}. It is the
+ * users responsibility to invoke {@link #start()}, when the injector has
+ * been created, and {@link #shutdown()}, when the application terminates.
+ */
 public interface ILifecycleController extends ILifecycleListener {
 	boolean add(ILifecycleListener pListener);
 	boolean remove(ILifecycleListener pListener);

Modified: commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/ILifecycleListener.java
URL: http://svn.apache.org/viewvc/commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/ILifecycleListener.java?rev=1646221&r1=1646220&r2=1646221&view=diff
==============================================================================
--- commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/ILifecycleListener.java
(original)
+++ commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/ILifecycleListener.java
Wed Dec 17 12:48:19 2014
@@ -16,6 +16,16 @@
 */
 package org.apache.commons.inject.api;
 
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+/** Interface of an object, which can be managed by the
+ * {@link ILifecycleController}. The {@link PostConstructModule}
+ * detects objects annotated with {@link PostConstruct}, and
+ * {@link PreDestroy}, wraps them in an instance of
+ * {@link ILifecycleListener}, which delegates to the respective
+ * methods, and adds the wrappers to the lifecycle controller.
+ */
 public interface ILifecycleListener {
 	void start();
 	void shutdown();

Modified: commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/IPoint.java
URL: http://svn.apache.org/viewvc/commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/IPoint.java?rev=1646221&r1=1646220&r2=1646221&view=diff
==============================================================================
--- commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/IPoint.java
(original)
+++ commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/IPoint.java
Wed Dec 17 12:48:19 2014
@@ -16,6 +16,19 @@
 */
 package org.apache.commons.inject.api;
 
+import org.apache.commons.inject.api.bind.IBinder;
+import org.apache.commons.inject.api.bind.IModule;
+
+
+/**
+ * A point implements injection of values into a field, or method.
+ * Of course, several points may be combined into more complex points,
+ * etc.
+ * {@link IModule modules} may inject additional values by implementing
+ * {@link IBinder.InjectionParticipator} and adding listeners via
+ * {@link IBinder#add(org.apache.commons.inject.api.bind.IBinder.IInjectionParticipator)}.
+ * This is done, for example, by the {@link AbstractLoggerInjectingModule}.
+ */
 public interface IPoint<T> {
 	void injectTo(T pInstance, IInjector pInjector);
 }

Modified: commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/IProvider.java
URL: http://svn.apache.org/viewvc/commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/IProvider.java?rev=1646221&r1=1646220&r2=1646221&view=diff
==============================================================================
--- commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/IProvider.java
(original)
+++ commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/IProvider.java
Wed Dec 17 12:48:19 2014
@@ -18,6 +18,11 @@ package org.apache.commons.inject.api;
 
 import javax.inject.Provider;
 
+import org.apache.commons.inject.api.bind.IModule;
+
+/**
+ * An object factory, which may be supplied by the {@link IModule module}.
+ */
 public interface IProvider<T> extends Provider<T> {
 	Class<? extends T> getType();
 	T get(IInjector pInjector);

Modified: commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/InjLogger.java
URL: http://svn.apache.org/viewvc/commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/InjLogger.java?rev=1646221&r1=1646220&r2=1646221&view=diff
==============================================================================
--- commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/InjLogger.java
(original)
+++ commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/InjLogger.java
Wed Dec 17 12:48:19 2014
@@ -19,6 +19,15 @@ package org.apache.commons.inject.api;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 
+import javax.inject.Inject;
+
+/**
+ * Proprietary variant of {@link Inject}, which is supported by the
+ * {@link AbstractLoggerInjectingModule}, and its subclasses, to
+ * inject loggers. By default, the logger Id is the name of the
+ * class, which owns the annotated field. However, that default
+ * can be overwritten using {@link #id()}.
+ */
 @Retention(RetentionPolicy.RUNTIME)
 public @interface InjLogger {
 	String id() default "";

Modified: commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/Key.java
URL: http://svn.apache.org/viewvc/commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/Key.java?rev=1646221&r1=1646220&r2=1646221&view=diff
==============================================================================
--- commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/Key.java
(original)
+++ commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/Key.java
Wed Dec 17 12:48:19 2014
@@ -19,6 +19,9 @@ package org.apache.commons.inject.api;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Array;
 
+/**
+ * Default implementation of {@link IKey}.
+ */
 public class Key<T> implements IKey<T> {
 	public static final String NO_NAME = "";
 	public static final Annotation[] NO_ANNOTATIONS = (Annotation[]) Array.newInstance(Annotation.class,
0);

Modified: commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/bind/ILinkedBindingBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/bind/ILinkedBindingBuilder.java?rev=1646221&r1=1646220&r2=1646221&view=diff
==============================================================================
--- commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/bind/ILinkedBindingBuilder.java
(original)
+++ commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/bind/ILinkedBindingBuilder.java
Wed Dec 17 12:48:19 2014
@@ -21,7 +21,7 @@ import java.lang.reflect.Method;
 
 import org.apache.commons.inject.api.IProvider;
 
-import com.google.inject.Provider;
+import javax.inject.Provider;
 
 /**
  * A binding builder, which allows to specify a bindings target: A

Modified: commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/impl/AbstractScopedProvider.java
URL: http://svn.apache.org/viewvc/commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/impl/AbstractScopedProvider.java?rev=1646221&r1=1646220&r2=1646221&view=diff
==============================================================================
--- commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/impl/AbstractScopedProvider.java
(original)
+++ commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/impl/AbstractScopedProvider.java
Wed Dec 17 12:48:19 2014
@@ -19,6 +19,11 @@ package org.apache.commons.inject.impl;
 import org.apache.commons.inject.api.IInjector;
 import org.apache.commons.inject.api.IProvider;
 
+/**
+ * Abstract base class for providers, which handle scopes.
+ * The details of instantiation and value injection are left to the
+ * {@link AbstractBaseProvider}.
+ */
 public abstract class AbstractScopedProvider<T> implements IProvider<T>, IInjectorAware
{
 	private final IProvider<T> baseProvider;
 	private IInjector injector;

Modified: commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/impl/bind/DefaultBindingBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/impl/bind/DefaultBindingBuilder.java?rev=1646221&r1=1646220&r2=1646221&view=diff
==============================================================================
--- commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/impl/bind/DefaultBindingBuilder.java
(original)
+++ commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/impl/bind/DefaultBindingBuilder.java
Wed Dec 17 12:48:19 2014
@@ -41,7 +41,7 @@ import org.apache.commons.inject.impl.Li
 import org.apache.commons.inject.impl.MutableBindingSet;
 import org.apache.commons.inject.impl.AbstractBindingSet.MappedKey;
 
-import com.google.inject.Provider;
+import javax.inject.Provider;
 
 
 /**

Modified: commons/sandbox/commons-inject/trunk/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/commons/sandbox/commons-inject/trunk/src/site/apt/index.apt?rev=1646221&r1=1646220&r2=1646221&view=diff
==============================================================================
--- commons/sandbox/commons-inject/trunk/src/site/apt/index.apt (original)
+++ commons/sandbox/commons-inject/trunk/src/site/apt/index.apt Wed Dec 17 12:48:19 2014
@@ -49,14 +49,18 @@
  
   * Commons Inject is based on the standard Java reflection API <<only>>. As
a consequence, it
     should work on Android.
+
   * Commons Inject doesn't distinguish between production mode, and development mode.
     OTOH, its startup time should be <<much>> faster than Guice in production
mode.
+
   * Commons Inject provides some extensions out of the box:
+
     * Support for an {{{./lifecycle.html}Application Lifecycle}}, including support for
       {{{http://docs.oracle.com/javaee/5/api/javax/annotation/PostConstruct.html}@PostConstruct}},
       and {{{http://docs.oracle.com/javaee/5/api/javax/annotation/PreDestroy.html}@PreDestroy}}.
       This lifecycle support works with arbitrary objects, including eager, or lazy
       singletons.
+
     * {{{./loggerInjection.html}Logger injection}} via Log4J, SLF4J, or Commons Logging.
       (Adding support for other frameworks should be extremely easy.)
 



Mime
View raw message