├── .gitignore ├── .project ├── README.md ├── annotations ├── pom.xml └── src │ └── main │ └── java │ └── de │ └── devsurf │ └── injection │ └── guice │ ├── annotations │ ├── Bind.java │ ├── GuiceAnnotation.java │ ├── GuiceModule.java │ └── To.java │ └── install │ └── BindingStage.java ├── aop ├── pom.xml └── src │ ├── main │ └── java │ │ ├── de │ │ └── devsurf │ │ │ └── injection │ │ │ └── guice │ │ │ └── aop │ │ │ ├── ClassMatcher.java │ │ │ ├── GuiceMethodInterceptor.java │ │ │ ├── Intercept.java │ │ │ ├── Invoke.java │ │ │ ├── MethodMatcher.java │ │ │ └── feature │ │ │ └── InterceptorFeature.java │ │ └── javax │ │ └── interceptor │ │ ├── AroundInvoke.java │ │ └── Interceptor.java │ └── test │ └── java │ └── de │ └── devsurf │ └── injection │ └── guice │ └── test │ └── aop │ ├── AllTests.java │ ├── annoherited │ └── AnnoheritedInterceptorTests.java │ ├── annotated │ └── AnnotatedInterceptorTests.java │ ├── inherited │ └── InheritedInterceptorTests.java │ └── invalid │ └── InvalidInterceptorTests.java ├── core ├── pom.xml └── src │ ├── main │ ├── beans_1_0.xsd │ └── java │ │ └── de │ │ └── devsurf │ │ └── injection │ │ └── guice │ │ ├── annotations │ │ ├── Annotations.java │ │ └── features │ │ │ ├── AutoBindingFeature.java │ │ │ ├── ImplementationBindingFeature.java │ │ │ ├── ModuleBindingFeature.java │ │ │ └── MultiBindingFeature.java │ │ ├── configuration │ │ ├── Configuration.java │ │ ├── ConfigurationModule.java │ │ ├── PathConfig.java │ │ ├── PropertiesProvider.java │ │ ├── PropertiesReader.java │ │ ├── VariableResolver.java │ │ └── features │ │ │ └── ConfigurationFeature.java │ │ ├── install │ │ ├── BindingTracer.java │ │ ├── InstallationContext.java │ │ └── bindjob │ │ │ ├── BindingJob.java │ │ │ ├── ConfigurationBindingJob.java │ │ │ ├── ConstantBindingJob.java │ │ │ ├── ImplementationBindingJob.java │ │ │ ├── InstanceBindingJob.java │ │ │ ├── InterfaceBindingJob.java │ │ │ ├── ModuleBindingJob.java │ │ │ ├── MultiBindingJob.java │ │ │ └── ProviderBindingJob.java │ │ ├── jsr330 │ │ ├── NamedImpl.java │ │ └── Names.java │ │ ├── scanner │ │ ├── ClasspathScanner.java │ │ ├── PackageFilter.java │ │ ├── ScannerModule.java │ │ ├── StartupModule.java │ │ └── features │ │ │ ├── BindingScannerFeature.java │ │ │ ├── MultiBindingScannerFeature.java │ │ │ └── ScannerFeature.java │ │ └── serviceloader │ │ ├── ModuleLoader.java │ │ ├── MultiServiceLoaderProvider.java │ │ ├── ServiceLoaderFeature.java │ │ ├── ServiceLoaderModule.java │ │ └── SingleServiceLoaderProvider.java │ └── test │ └── resources │ ├── beans.xml │ └── conf │ └── startup.xml ├── etc └── header.txt ├── examples ├── pom.xml └── src │ └── main │ ├── java │ └── de │ │ └── devsurf │ │ └── injection │ │ └── guice │ │ ├── aop │ │ ├── MethodCallingInterceptor.java │ │ └── example │ │ │ └── interceptor │ │ │ ├── AnnotatedInheritedMethodInterceptor.java │ │ │ ├── AnnotatedMethodInterceptor.java │ │ │ ├── Example.java │ │ │ ├── ExampleApp.java │ │ │ ├── ExampleImpl.java │ │ │ ├── InheritedMethodInterceptor.java │ │ │ └── InvalidMethodInterceptor.java │ │ ├── configuration │ │ └── example │ │ │ ├── commons │ │ │ ├── general │ │ │ │ ├── Example.java │ │ │ │ ├── ExampleApp.java │ │ │ │ ├── ExampleConfiguration.java │ │ │ │ ├── ExampleImpl.java │ │ │ │ └── ExampleModule.java │ │ │ └── plist │ │ │ │ ├── Example.java │ │ │ │ ├── ExampleApp.java │ │ │ │ ├── ExampleConfiguration.java │ │ │ │ ├── ExampleImpl.java │ │ │ │ └── ExampleModule.java │ │ │ └── map │ │ │ ├── dynamic │ │ │ ├── Example.java │ │ │ ├── ExampleApp.java │ │ │ ├── ExampleConfiguration.java │ │ │ ├── ExampleImpl.java │ │ │ └── ExampleModule.java │ │ │ ├── general │ │ │ ├── Example.java │ │ │ ├── ExampleApp.java │ │ │ ├── ExampleConfiguration.java │ │ │ ├── ExampleImpl.java │ │ │ └── ExampleModule.java │ │ │ ├── lazy │ │ │ ├── Example.java │ │ │ ├── ExampleApp.java │ │ │ ├── ExampleConfiguration.java │ │ │ ├── ExampleImpl.java │ │ │ └── ExampleModule.java │ │ │ └── named │ │ │ ├── Example.java │ │ │ ├── ExampleApp.java │ │ │ ├── ExampleConfiguration.java │ │ │ ├── ExampleImpl.java │ │ │ └── ExampleModule.java │ │ ├── example │ │ └── starter │ │ │ ├── ExampleApplication.java │ │ │ ├── ExampleStarter.java │ │ │ └── ExampleStartupModule.java │ │ ├── integrations │ │ └── example │ │ │ ├── guicy │ │ │ ├── automodule │ │ │ │ ├── Example.java │ │ │ │ ├── ExampleApp.java │ │ │ │ ├── ExampleImpl.java │ │ │ │ └── ExampleModule.java │ │ │ └── jndi │ │ │ │ ├── Example.java │ │ │ │ ├── ExampleApp.java │ │ │ │ ├── ExampleImpl.java │ │ │ │ └── ExampleModule.java │ │ │ └── rocoto │ │ │ ├── Example.java │ │ │ ├── ExampleApp.java │ │ │ ├── ExampleConfiguration.java │ │ │ ├── ExampleImpl.java │ │ │ └── ExampleModule.java │ │ └── scanner │ │ ├── asm │ │ └── example │ │ │ ├── autobind │ │ │ ├── Example.java │ │ │ ├── ExampleApp.java │ │ │ ├── ExampleImpl.java │ │ │ ├── inherited │ │ │ │ ├── Example.java │ │ │ │ ├── ExampleApp.java │ │ │ │ ├── ExampleImpl.java │ │ │ │ └── InheritedExampleImpl.java │ │ │ ├── marker │ │ │ │ ├── Example.java │ │ │ │ ├── ExampleApp.java │ │ │ │ ├── FirstImpl.java │ │ │ │ ├── FirstMarker.java │ │ │ │ ├── SecondImpl.java │ │ │ │ └── SecondMarker.java │ │ │ ├── multiple │ │ │ │ ├── Example.java │ │ │ │ ├── ExampleApp.java │ │ │ │ ├── ExampleContainer.java │ │ │ │ ├── ExampleOneImpl.java │ │ │ │ └── ExampleTwoImpl.java │ │ │ └── names │ │ │ │ ├── Example.java │ │ │ │ ├── ExampleApp.java │ │ │ │ └── ExampleImpl.java │ │ │ ├── automodule │ │ │ ├── Example.java │ │ │ ├── ExampleApp.java │ │ │ ├── ExampleImpl.java │ │ │ └── ExampleModule.java │ │ │ └── startupmodule │ │ │ ├── Example.java │ │ │ ├── ExampleApp.java │ │ │ ├── ExampleImpl.java │ │ │ ├── ExampleModule.java │ │ │ └── ExampleStartupModule.java │ │ ├── reflections │ │ └── example │ │ │ ├── autobind │ │ │ ├── Example.java │ │ │ ├── ExampleApp.java │ │ │ ├── ExampleImpl.java │ │ │ ├── multiple │ │ │ │ ├── Example.java │ │ │ │ ├── ExampleApp.java │ │ │ │ ├── ExampleContainer.java │ │ │ │ ├── ExampleOneImpl.java │ │ │ │ └── ExampleTwoImpl.java │ │ │ └── names │ │ │ │ ├── Example.java │ │ │ │ ├── ExampleApp.java │ │ │ │ └── ExampleImpl.java │ │ │ ├── automodule │ │ │ ├── Example.java │ │ │ ├── ExampleApp.java │ │ │ ├── ExampleImpl.java │ │ │ └── ExampleModule.java │ │ │ └── startupmodule │ │ │ ├── Example.java │ │ │ ├── ExampleApp.java │ │ │ ├── ExampleImpl.java │ │ │ ├── ExampleModule.java │ │ │ └── ExampleStartupModule.java │ │ └── sonatype │ │ └── example │ │ ├── autobind │ │ ├── Example.java │ │ ├── ExampleApp.java │ │ ├── ExampleImpl.java │ │ ├── ExampleStartupModule.java │ │ ├── multiple │ │ │ ├── Example.java │ │ │ ├── ExampleApp.java │ │ │ ├── ExampleContainer.java │ │ │ ├── ExampleOneImpl.java │ │ │ └── ExampleTwoImpl.java │ │ └── names │ │ │ ├── Example.java │ │ │ ├── ExampleApp.java │ │ │ ├── ExampleImpl.java │ │ │ └── ExampleStartupModule.java │ │ ├── automodule │ │ ├── Example.java │ │ ├── ExampleApp.java │ │ ├── ExampleImpl.java │ │ ├── ExampleModule.java │ │ └── ExampleStartupModule.java │ │ └── startupmodule │ │ ├── Example.java │ │ ├── ExampleApp.java │ │ ├── ExampleImpl.java │ │ ├── ExampleModule.java │ │ └── ExampleStartupModule.java │ └── resources │ ├── configuration.plist │ ├── configuration.properties │ └── jndi.properties ├── integrations ├── commons.configurations │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── de │ │ │ └── devsurf │ │ │ └── injection │ │ │ └── guice │ │ │ └── integrations │ │ │ └── commons │ │ │ └── configuration │ │ │ └── CommonsConfigurationFeature.java │ │ └── test │ │ ├── java │ │ └── de │ │ │ └── devsurf │ │ │ └── injection │ │ │ └── guice │ │ │ └── integrations │ │ │ └── test │ │ │ └── commons │ │ │ └── configuration │ │ │ ├── AllTests.java │ │ │ ├── classpath │ │ │ └── ClasspathConfigTests.java │ │ │ ├── file │ │ │ └── FileConfigTests.java │ │ │ └── url │ │ │ └── URLConfigTests.java │ │ └── resources │ │ └── configuration.plist ├── enterprise │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ ├── de │ │ │ └── devsurf │ │ │ │ └── injection │ │ │ │ └── guice │ │ │ │ └── enterprise │ │ │ │ ├── Annotations.java │ │ │ │ ├── BeansXMLFeature.java │ │ │ │ ├── BeansXMLModule.java │ │ │ │ ├── features │ │ │ │ ├── WebFilterBindingFeature.java │ │ │ │ └── WebServletBindingFeature.java │ │ │ │ └── model │ │ │ │ ├── Alternatives.java │ │ │ │ ├── Beans.java │ │ │ │ ├── Decorators.java │ │ │ │ └── Interceptors.java │ │ │ └── javax │ │ │ ├── enterprise │ │ │ └── inject │ │ │ │ └── Alternative.java │ │ │ └── servlet │ │ │ └── annotation │ │ │ ├── WebFilter.java │ │ │ └── WebServlet.java │ │ └── test │ │ ├── java │ │ └── de │ │ │ └── devsurf │ │ │ └── injection │ │ │ └── guice │ │ │ └── integrations │ │ │ └── tests │ │ │ └── enterprise │ │ │ ├── AllTests.java │ │ │ └── EnterpriseTests.java │ │ └── resources │ │ ├── META-INF │ │ └── beans.xml │ │ └── beans.xml ├── guicyfruit │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── de │ │ │ └── devsurf │ │ │ └── injection │ │ │ └── guice │ │ │ └── integrations │ │ │ └── guicyfruit │ │ │ ├── JSR250Module.java │ │ │ └── jndi │ │ │ └── GuicyInitialContextFactory.java │ │ └── test │ │ ├── java │ │ └── de │ │ │ └── devsurf │ │ │ └── injection │ │ │ └── guice │ │ │ └── integrations │ │ │ └── test │ │ │ └── guicyfruit │ │ │ ├── AllTests.java │ │ │ ├── jndi │ │ │ └── JNDIConstructionTests.java │ │ │ └── post │ │ │ └── PostConstructionTests.java │ │ └── resources │ │ └── jndi.properties ├── metro │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── de │ │ │ └── devsurf │ │ │ └── injection │ │ │ └── guice │ │ │ └── integrations │ │ │ └── metro │ │ │ ├── AutomaticGuiceManager.java │ │ │ ├── GuiceContextListener.java │ │ │ ├── GuiceManaged.java │ │ │ ├── GuiceManagedFeature.java │ │ │ └── InjectorProvider.java │ │ └── test │ │ └── resources │ │ └── jndi.properties └── pom.xml ├── pom.xml ├── scanner ├── asm │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── de │ │ │ └── devsurf │ │ │ └── injection │ │ │ └── guice │ │ │ └── scanner │ │ │ └── asm │ │ │ ├── ASMClasspathScanner.java │ │ │ └── AnnotationCollector.java │ │ └── test │ │ ├── java │ │ └── de │ │ │ └── devsurf │ │ │ └── injection │ │ │ └── guice │ │ │ └── scanner │ │ │ └── asm │ │ │ └── tests │ │ │ ├── AllTests.java │ │ │ └── autobind │ │ │ ├── AutobindTests.java │ │ │ ├── bind │ │ │ └── InterfaceAutobindTests.java │ │ │ ├── duplicate │ │ │ └── DuplicateAutobindTests.java │ │ │ ├── filter │ │ │ ├── PackageFilterTests.java │ │ │ └── dummy │ │ │ │ └── DummyImplementation.java │ │ │ ├── multiple │ │ │ └── MultibindTests.java │ │ │ ├── names │ │ │ └── NamedAutobindTests.java │ │ │ ├── only │ │ │ └── ImplementationOnlyTests.java │ │ │ ├── provider │ │ │ ├── Container.java │ │ │ ├── Mode.java │ │ │ └── ProviderTest.java │ │ │ └── startconfig │ │ │ ├── Container.java │ │ │ ├── Mode.java │ │ │ └── StartConfigProviderTest.java │ │ └── resources │ │ └── conf │ │ └── startup.xml ├── pom.xml ├── reflections │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── de │ │ │ └── devsurf │ │ │ └── injection │ │ │ └── guice │ │ │ └── scanner │ │ │ └── reflections │ │ │ └── ReflectionsScanner.java │ │ └── test │ │ └── java │ │ └── de │ │ └── devsurf │ │ └── injection │ │ └── guice │ │ └── scanner │ │ └── reflections │ │ └── tests │ │ ├── AllTests.java │ │ └── autobind │ │ ├── AutobindTests.java │ │ ├── bind │ │ └── InterfaceAutobindTests.java │ │ ├── filter │ │ ├── PackageFilterTests.java │ │ └── dummy │ │ │ └── DummyImplementation.java │ │ ├── multiple │ │ └── MultibindTests.java │ │ └── names │ │ └── NamedAutobindTests.java └── sonatype │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── de │ │ └── devsurf │ │ └── injection │ │ └── guice │ │ └── scanner │ │ └── sonatype │ │ ├── FilterAnnotationCollector.java │ │ └── SonatypeScanner.java │ └── test │ └── java │ └── de │ └── devsurf │ └── injection │ └── guice │ └── scanner │ └── sonatype │ └── tests │ ├── AllTests.java │ └── autobind │ ├── AutobindTests.java │ ├── bind │ └── InterfaceAutobindTests.java │ ├── filter │ ├── PackageFilterTests.java │ └── dummy │ │ └── DummyImplementation.java │ ├── multiple │ └── MultibindTests.java │ └── names │ └── NamedAutobindTests.java └── tests ├── pom.xml └── src └── test ├── java └── de │ └── devsurf │ └── injection │ └── guice │ └── test │ └── configuration │ ├── AllTests.java │ ├── classpath │ ├── ClasspathConfigTests.java │ ├── both │ │ └── BothClasspathConfigTests.java │ └── values │ │ └── ValuesClasspathConfigTests.java │ ├── duplicate │ └── DuplicateClasspathConfigTests.java │ ├── failure │ └── FailureConfigTests.java │ ├── file │ ├── FileConfigTests.java │ ├── both │ │ └── BothFileConfigTests.java │ ├── override │ │ ├── DirectFileConfigTests.java │ │ └── OverrideFileConfigTests.java │ └── values │ │ └── ValueFileConfigTests.java │ ├── folder │ └── FolderConfigTests.java │ └── url │ ├── URLConfigTests.java │ ├── both │ └── BothURLConfigTests.java │ ├── override │ ├── DirectOverrideConfigTests.java │ └── OverrideConfigTests.java │ └── values │ └── ValuesURLConfigTests.java └── resources ├── conf ├── functions.properties └── messages.properties ├── configuration.override.properties └── configuration.properties /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.so 9 | 10 | # Packages # 11 | ############ 12 | # it's better to unpack these files and commit the raw source 13 | # git has its own built in compression methods 14 | *.7z 15 | *.dmg 16 | *.gz 17 | *.iso 18 | *.jar 19 | *.rar 20 | *.tar 21 | *.zip 22 | 23 | # Logs and databases # 24 | ###################### 25 | *.log 26 | *.sql 27 | *.sqlite 28 | 29 | # OS generated files # 30 | ###################### 31 | .DS_Store? 32 | ehthumbs.db 33 | Icon? 34 | Thumbs.db 35 | 36 | *.settings 37 | .settings/* 38 | */.settings/* 39 | **/.settings 40 | **/*.settings 41 | */target/* 42 | **/target/* 43 | **/target/** 44 | target/* 45 | target/** 46 | */bin/* 47 | **/bin/* 48 | *.classpath 49 | *.mymetadata 50 | *.project 51 | **/*.project 52 | .idea/ 53 | *.iml 54 | target/ -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | de.devsurf.injection.guice 4 | Goolge Guice-Extension which add the support for Classpath Scanner and auto registration for Guice-Modules and Beans. ASM, Reflections/Javassit or a Sonatype-Guice-Extension can be used as Classpath Scanner. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.maven.ide.eclipse.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.maven.ide.eclipse.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /annotations/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | de.devsurf.injection.guice 5 | extensions 6 | 0.9.1-SNAPSHOT 7 | 8 | de.devsurf.injection.guice 9 | de.devsurf.injection.guice.annotations 10 | jar 11 | 12 | ${project.parent.basedir} 13 | 14 | -------------------------------------------------------------------------------- /annotations/src/main/java/de/devsurf/injection/guice/annotations/GuiceAnnotation.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.annotations; 17 | 18 | @java.lang.annotation.Target(value={java.lang.annotation.ElementType.ANNOTATION_TYPE}) 19 | @java.lang.annotation.Retention(value=java.lang.annotation.RetentionPolicy.RUNTIME) 20 | @java.lang.annotation.Documented 21 | public @interface GuiceAnnotation { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /annotations/src/main/java/de/devsurf/injection/guice/annotations/GuiceModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.annotations; 17 | 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | import javax.inject.Qualifier; 24 | 25 | import de.devsurf.injection.guice.install.BindingStage; 26 | 27 | /** 28 | * Annotate a Module with the GuiceModule-Annotation and it will be installed 29 | * automatically. 30 | * 31 | * @author Daniel Manzke 32 | * 33 | */ 34 | @Retention(RetentionPolicy.RUNTIME) 35 | @Qualifier 36 | @GuiceAnnotation 37 | @Target( { ElementType.TYPE }) 38 | public @interface GuiceModule { 39 | BindingStage stage() default BindingStage.BUILD; 40 | } 41 | -------------------------------------------------------------------------------- /annotations/src/main/java/de/devsurf/injection/guice/annotations/To.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * 18 | */ 19 | package de.devsurf.injection.guice.annotations; 20 | 21 | public @interface To { 22 | Type value() default Type.INTERFACES; 23 | 24 | Class[] customs() default {}; 25 | 26 | public static enum Type { 27 | /** 28 | * Binds the Implementation to itself. Equals 29 | * binder.bind(Implementation.class); 30 | */ 31 | IMPLEMENTATION, 32 | /** 33 | * Binds the Implementation to all implemented Interfaces. 34 | * 35 | * Equals: for(Interface interface: implementedInterfaces) 36 | * binder.bind(interface).to(implementation); 37 | */ 38 | INTERFACES, 39 | /** 40 | * Binds the Implementation to the extended Super-Class. Equals: 41 | * binder.bind(superclass).to(implementation); 42 | */ 43 | SUPER, 44 | /** 45 | * Binds the Implementation to the Classes specifed by @To(to={}) 46 | * 47 | * Equals: for(Class class: toClasses) 48 | * binder.bind(class).to(implementation); 49 | */ 50 | CUSTOM 51 | } 52 | } -------------------------------------------------------------------------------- /annotations/src/main/java/de/devsurf/injection/guice/install/BindingStage.java: -------------------------------------------------------------------------------- 1 | package de.devsurf.injection.guice.install; 2 | 3 | import java.util.LinkedList; 4 | import java.util.List; 5 | 6 | public enum BindingStage { 7 | INTERNAL, 8 | BOOT_BEFORE, 9 | BOOT, 10 | BOOT_POST, 11 | BINDING_BEFORE, 12 | BINDING, 13 | BINDING_POST, 14 | INSTALL_BEFORE, 15 | INSTALL, 16 | INSTALL_POST, 17 | BUILD_BEFORE, 18 | BUILD, 19 | BUILD_POST, 20 | IGNORE; 21 | 22 | public static final List ORDERED = new LinkedList(); 23 | 24 | static { 25 | ORDERED.add(INTERNAL); 26 | ORDERED.add(BOOT_BEFORE); 27 | ORDERED.add(BOOT); 28 | ORDERED.add(BOOT_POST); 29 | ORDERED.add(BINDING_BEFORE); 30 | ORDERED.add(BINDING); 31 | ORDERED.add(BINDING_POST); 32 | ORDERED.add(INSTALL_BEFORE); 33 | ORDERED.add(INSTALL); 34 | ORDERED.add(INSTALL_POST); 35 | ORDERED.add(BUILD_BEFORE); 36 | ORDERED.add(BUILD); 37 | ORDERED.add(BUILD_POST); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /aop/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | extensions 5 | de.devsurf.injection.guice 6 | 0.9.1-SNAPSHOT 7 | 8 | de.devsurf.injection.guice 9 | de.devsurf.injection.guice.aop 10 | 0.9.1-SNAPSHOT 11 | 12 | 13 | ${project.parent.basedir} 14 | 15 | 16 | 17 | de.devsurf.injection.guice 18 | de.devsurf.injection.guice.core 19 | 0.9.1-SNAPSHOT 20 | 21 | 22 | aopalliance 23 | aopalliance 24 | 1.0 25 | jar 26 | compile 27 | 28 | 29 | de.devsurf.injection.guice.scanner 30 | de.devsurf.injection.guice.scanner.asm 31 | 0.9.1-SNAPSHOT 32 | jar 33 | test 34 | 35 | 36 | -------------------------------------------------------------------------------- /aop/src/main/java/de/devsurf/injection/guice/aop/ClassMatcher.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * 18 | */ 19 | package de.devsurf.injection.guice.aop; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | import org.aopalliance.intercept.MethodInterceptor; 27 | 28 | /** 29 | * This Annotation marks a Method, which returns an Object of Type 30 | * {@link Matcher}. This Matcher is used by Guice, to decide if a 31 | * {@link MethodInterceptor} should be invoked for that {@link Class}. 32 | * 33 | * @ClassMatcher public Matcher> getClassMatcher() { return 34 | * Matchers.any(); } 35 | * 36 | * @author Daniel Manzke 37 | * 38 | */ 39 | @Retention(RetentionPolicy.RUNTIME) 40 | @Target( { ElementType.METHOD }) 41 | public @interface ClassMatcher { 42 | } -------------------------------------------------------------------------------- /aop/src/main/java/de/devsurf/injection/guice/aop/Intercept.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * 18 | */ 19 | package de.devsurf.injection.guice.aop; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | import org.aopalliance.intercept.MethodInterceptor; 27 | 28 | /** 29 | * This is an Annotation, which can be used to create a {@link MethodMatcher}, 30 | * so an {@link MethodInterceptor} knows which Method to monitor. 31 | * 32 | * @Intercept public String sayHello() { return "yeahhh!!!"; } 33 | * 34 | * @author Daniel Manzke 35 | * 36 | */ 37 | @Retention(RetentionPolicy.RUNTIME) 38 | @Target( { ElementType.METHOD }) 39 | public @interface Intercept { 40 | } -------------------------------------------------------------------------------- /aop/src/main/java/de/devsurf/injection/guice/aop/Invoke.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * 18 | */ 19 | package de.devsurf.injection.guice.aop; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | /** 27 | * This Annotation marks a Method, which should be invoked for each Method, 28 | * which is matching the Criterias of this Interceptor. 29 | * 30 | * @Invoke public Object invoke(MethodInvocation invocation) throws Throwable { 31 | * return invocation.proceed(); } 32 | * 33 | * @author Daniel Manzke 34 | * 35 | */ 36 | @Retention(RetentionPolicy.RUNTIME) 37 | @Target( { ElementType.METHOD }) 38 | public @interface Invoke { 39 | } -------------------------------------------------------------------------------- /aop/src/main/java/de/devsurf/injection/guice/aop/MethodMatcher.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * 18 | */ 19 | package de.devsurf.injection.guice.aop; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | import java.lang.reflect.Method; 26 | 27 | import org.aopalliance.intercept.MethodInterceptor; 28 | 29 | /** 30 | * This Annotation marks a Method, which returns an Object of Type 31 | * {@link Matcher}. This Matcher is used by Guice, to decide if a 32 | * {@link MethodInterceptor} should be invoked for that {@link Method}. 33 | * 34 | * @MethodMatcher public Matcher getMethodMatcher() { return 35 | * Matchers.annotatedWith(Intercept.class); } 36 | * 37 | * @author Daniel Manzke 38 | * 39 | */ 40 | @Retention(RetentionPolicy.RUNTIME) 41 | @Target( { ElementType.METHOD }) 42 | public @interface MethodMatcher { 43 | } -------------------------------------------------------------------------------- /aop/src/main/java/javax/interceptor/AroundInvoke.java: -------------------------------------------------------------------------------- 1 | package javax.interceptor; 2 | 3 | @java.lang.annotation.Target(value={java.lang.annotation.ElementType.METHOD}) 4 | @java.lang.annotation.Retention(value=java.lang.annotation.RetentionPolicy.RUNTIME) 5 | public @interface AroundInvoke { 6 | 7 | } -------------------------------------------------------------------------------- /aop/src/main/java/javax/interceptor/Interceptor.java: -------------------------------------------------------------------------------- 1 | package javax.interceptor; 2 | 3 | @java.lang.annotation.Retention(value=java.lang.annotation.RetentionPolicy.RUNTIME) 4 | @java.lang.annotation.Target(value={java.lang.annotation.ElementType.TYPE}) 5 | @java.lang.annotation.Documented 6 | public @interface Interceptor { 7 | 8 | } -------------------------------------------------------------------------------- /aop/src/test/java/de/devsurf/injection/guice/test/aop/AllTests.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.test.aop; 17 | 18 | import org.junit.runner.RunWith; 19 | import org.junit.runners.Suite; 20 | 21 | import de.devsurf.injection.guice.test.aop.annoherited.AnnoheritedInterceptorTests; 22 | import de.devsurf.injection.guice.test.aop.annotated.AnnotatedInterceptorTests; 23 | import de.devsurf.injection.guice.test.aop.inherited.InheritedInterceptorTests; 24 | import de.devsurf.injection.guice.test.aop.invalid.InvalidInterceptorTests; 25 | 26 | @RunWith(Suite.class) 27 | @Suite.SuiteClasses( { AnnoheritedInterceptorTests.class, AnnotatedInterceptorTests.class, 28 | InheritedInterceptorTests.class, InvalidInterceptorTests.class }) 29 | public class AllTests { 30 | } 31 | -------------------------------------------------------------------------------- /core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | de.devsurf.injection.guice 5 | extensions 6 | 0.9.1-SNAPSHOT 7 | 8 | de.devsurf.injection.guice 9 | de.devsurf.injection.guice.core 10 | jar 11 | 12 | ${project.parent.basedir} 13 | 14 | 15 | 16 | com.googlecode.rocoto 17 | rocoto 18 | 4.0 19 | 20 | 21 | asm 22 | asm 23 | 3.3 24 | jar 25 | compile 26 | 27 | 28 | com.google.collections 29 | google-collections 30 | 1.0 31 | jar 32 | compile 33 | 34 | 35 | de.devsurf.injection.guice 36 | de.devsurf.injection.guice.annotations 37 | ${project.version} 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/configuration/ConfigurationModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration; 17 | 18 | import javax.inject.Singleton; 19 | 20 | import de.devsurf.injection.guice.annotations.GuiceModule; 21 | 22 | @Singleton 23 | @GuiceModule 24 | public class ConfigurationModule extends com.googlecode.rocoto.configuration.ConfigurationModule { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/configuration/PathConfig.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration; 17 | 18 | public @interface PathConfig { 19 | String value(); 20 | 21 | PathType type() default PathType.CLASSPATH; 22 | 23 | public enum PathType { 24 | /** 25 | * Use the Classloader to fetch the Configuration 26 | */ 27 | CLASSPATH, 28 | /** 29 | * Tries to load the Configuration from a File. Can be absolute or 30 | * relative. Relative to the the Path of ClassLoader.getResources("/"). 31 | */ 32 | FILE, 33 | /** 34 | * Can be each Kind of URL. file:/, classpath:/, http:// 35 | */ 36 | URL 37 | } 38 | } -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/configuration/PropertiesProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * 18 | */ 19 | package de.devsurf.injection.guice.configuration; 20 | 21 | import java.net.URL; 22 | import java.util.Properties; 23 | import java.util.logging.Level; 24 | import java.util.logging.Logger; 25 | 26 | import javax.inject.Provider; 27 | 28 | public class PropertiesProvider implements Provider { 29 | Logger _logger = Logger.getLogger(PropertiesProvider.class.getName()); 30 | 31 | private URL url; 32 | private boolean isXML; 33 | 34 | public PropertiesProvider(URL url, boolean isXML) { 35 | super(); 36 | this.url = url; 37 | this.isXML = isXML; 38 | } 39 | 40 | @Override 41 | public Properties get() { 42 | try { 43 | _logger.info("Doing lazy Loading for Configuration " + url); 44 | return new PropertiesReader(url, isXML).readNative(); 45 | } catch (Exception e) { 46 | _logger.log(Level.WARNING, "Configuration in " + url + " couldn't be read.", e); 47 | return new Properties(); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/install/BindingTracer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.install; 17 | 18 | import java.util.HashSet; 19 | import java.util.Iterator; 20 | import java.util.Set; 21 | 22 | import javax.inject.Singleton; 23 | 24 | import de.devsurf.injection.guice.install.bindjob.BindingJob; 25 | 26 | @Singleton 27 | public class BindingTracer implements Iterable{ 28 | private Set jobs = new HashSet(); 29 | 30 | public synchronized boolean add(BindingJob e) { 31 | return jobs.add(e); 32 | } 33 | 34 | public synchronized boolean contains(Object o) { 35 | return jobs.contains(o); 36 | } 37 | 38 | public Iterator iterator() { 39 | return jobs.iterator(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/install/bindjob/ConfigurationBindingJob.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.install.bindjob; 17 | 18 | import java.lang.annotation.Annotation; 19 | 20 | 21 | public class ConfigurationBindingJob extends BindingJob{ 22 | 23 | public ConfigurationBindingJob(Annotation annotated, String location) { 24 | super(null, null, annotated, location, null); 25 | } 26 | 27 | @Override 28 | public String toString() { 29 | return "ConfigurationBinding [annotated=" + annotated + ", location=" + className 30 | + "]"; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/install/bindjob/ConstantBindingJob.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.install.bindjob; 17 | 18 | import java.lang.annotation.Annotation; 19 | 20 | 21 | public class ConstantBindingJob extends BindingJob{ 22 | 23 | public ConstantBindingJob(Annotation annotated, String className) { 24 | super(null, null, annotated, className, "constant"); 25 | } 26 | 27 | @Override 28 | public String toString() { 29 | return "Constant"+super.toString(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/install/bindjob/ImplementationBindingJob.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.install.bindjob; 17 | 18 | import java.lang.annotation.Annotation; 19 | 20 | 21 | public class ImplementationBindingJob extends BindingJob{ 22 | 23 | public ImplementationBindingJob(Class scoped, Annotation annotated, 24 | String className) { 25 | super(scoped, null, annotated, className, null); 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return "Implementation"+super.toString(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/install/bindjob/InstanceBindingJob.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.install.bindjob; 17 | 18 | import java.lang.annotation.Annotation; 19 | 20 | 21 | public class InstanceBindingJob extends BindingJob{ 22 | 23 | public InstanceBindingJob(Class scoped, Annotation annotated, 24 | String className, String interfaceName) { 25 | super(scoped, null, annotated, className, interfaceName); 26 | } 27 | 28 | @Override 29 | public int hashCode() { 30 | final int prime = 31; 31 | int result = 1; 32 | result = prime * result + ((annotated == null) ? 0 : annotated.hashCode()); 33 | result = prime * result + ((interfaceName == null) ? 0 : interfaceName.hashCode()); 34 | result = prime * result + ((provided == null) ? 0 : provided.hashCode()); 35 | result = prime * result + ((scoped == null) ? 0 : scoped.hashCode()); 36 | return result; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return "Instance"+super.toString(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/install/bindjob/InterfaceBindingJob.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.install.bindjob; 17 | 18 | import java.lang.annotation.Annotation; 19 | 20 | public class InterfaceBindingJob extends BindingJob{ 21 | 22 | public InterfaceBindingJob(Class scoped, Annotation annotated, 23 | String className, String interfaceName) { 24 | super(scoped, null, annotated, className, interfaceName); 25 | } 26 | 27 | @Override 28 | public int hashCode() { 29 | final int prime = 31; 30 | int result = 1; 31 | result = prime * result + ((annotated == null) ? 0 : annotated.hashCode()); 32 | result = prime * result + ((interfaceName == null) ? 0 : interfaceName.hashCode()); 33 | result = prime * result + ((provided == null) ? 0 : provided.hashCode()); 34 | result = prime * result + ((scoped == null) ? 0 : scoped.hashCode()); 35 | return result; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "Interface"+super.toString(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/install/bindjob/ModuleBindingJob.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.install.bindjob; 17 | 18 | public class ModuleBindingJob extends BindingJob{ 19 | 20 | public ModuleBindingJob(String moduleName) { 21 | super(null, null, null, moduleName, null); 22 | } 23 | 24 | @Override 25 | public String toString() { 26 | return "Module"+super.toString(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/install/bindjob/MultiBindingJob.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.install.bindjob; 17 | 18 | import java.lang.annotation.Annotation; 19 | 20 | 21 | 22 | public class MultiBindingJob extends BindingJob{ 23 | 24 | public MultiBindingJob(Class scoped, Annotation annotated, 25 | String className, String interfaceName) { 26 | super(scoped, null, annotated, className, interfaceName); 27 | } 28 | 29 | @Override 30 | public int hashCode() { 31 | final int prime = 31; 32 | int result = 1; 33 | result = prime * result + ((annotated == null) ? 0 : annotated.hashCode()); 34 | result = prime * result + ((className == null) ? 0 : className.hashCode()); 35 | result = prime * result + ((interfaceName == null) ? 0 : interfaceName.hashCode()); 36 | result = prime * result + ((provided == null) ? 0 : provided.hashCode()); 37 | result = prime * result + ((scoped == null) ? 0 : scoped.hashCode()); 38 | return result; 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return "Multi"+super.toString(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/install/bindjob/ProviderBindingJob.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.install.bindjob; 17 | 18 | import java.lang.annotation.Annotation; 19 | 20 | import javax.inject.Provider; 21 | 22 | public class ProviderBindingJob extends BindingJob{ 23 | 24 | @SuppressWarnings("rawtypes") 25 | public ProviderBindingJob(Class scoped, Class provided, Annotation annotated, String interfaceName) { 26 | super(scoped, provided, annotated, null, interfaceName); 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return "Provider"+super.toString(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/jsr330/NamedImpl.java: -------------------------------------------------------------------------------- 1 | package de.devsurf.injection.guice.jsr330; 2 | 3 | import java.io.Serializable; 4 | import java.lang.annotation.Annotation; 5 | 6 | import javax.inject.Named; 7 | 8 | class NamedImpl implements Named, Serializable { 9 | 10 | private final String value; 11 | 12 | public NamedImpl(String value) { 13 | this.value = value; 14 | } 15 | 16 | public String value() { 17 | return this.value; 18 | } 19 | 20 | public int hashCode() { 21 | // This is specified in java.lang.Annotation. 22 | return (127 * "value".hashCode()) ^ value.hashCode(); 23 | } 24 | 25 | public boolean equals(Object o) { 26 | if (!(o instanceof Named)) { 27 | return false; 28 | } 29 | 30 | Named other = (Named) o; 31 | return value.equals(other.value()); 32 | } 33 | 34 | public String toString() { 35 | return "@" + Named.class.getName() + "(value=" + value + ")"; 36 | } 37 | 38 | public Class annotationType() { 39 | return Named.class; 40 | } 41 | 42 | private static final long serialVersionUID = 0; 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/jsr330/Names.java: -------------------------------------------------------------------------------- 1 | package de.devsurf.injection.guice.jsr330; 2 | 3 | import javax.inject.Named; 4 | 5 | public class Names { 6 | 7 | private Names() {} 8 | 9 | /** 10 | * Creates a {@link Named} annotation with {@code name} as the value. 11 | */ 12 | public static Named named(String name) { 13 | return new NamedImpl(name); 14 | } 15 | } -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/scanner/features/ScannerFeature.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.features; 17 | 18 | import java.lang.annotation.Annotation; 19 | import java.util.Map; 20 | 21 | /** 22 | * This Interface is used, if you want get informed, for Classes with 23 | * Annotations. This is used for creating Classes for the automatic Module 24 | * installation or the automatic Bean binding. 25 | * 26 | * You will get the Class for the annotated one and a Proxy of the attached 27 | * Annotations. 28 | * 29 | * @author Daniel Manzke 30 | * 31 | */ 32 | public interface ScannerFeature { 33 | void found(Class annotatedClass, Map annotations); 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/serviceloader/ModuleLoader.java: -------------------------------------------------------------------------------- 1 | package de.devsurf.injection.guice.serviceloader; 2 | 3 | import java.util.ServiceLoader; 4 | import java.util.logging.Level; 5 | import java.util.logging.Logger; 6 | 7 | import com.google.inject.AbstractModule; 8 | import com.google.inject.Module; 9 | 10 | public class ModuleLoader extends AbstractModule { 11 | private Logger _logger = Logger.getLogger(ServiceLoaderModule.class.getName()); 12 | 13 | private final Class type; 14 | 15 | public ModuleLoader(Class type) { 16 | this.type = type; 17 | } 18 | 19 | public static ModuleLoader of(Class type) { 20 | return new ModuleLoader(type); 21 | } 22 | 23 | @Override 24 | protected void configure() { 25 | ServiceLoader modules = ServiceLoader.load(type); 26 | for (Module module : modules) { 27 | try { 28 | install(module); 29 | } catch (Exception e) { 30 | _logger.log(Level.WARNING, "Module can't be installed, because an Exception was raised. "+e.getMessage(), e); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/serviceloader/MultiServiceLoaderProvider.java: -------------------------------------------------------------------------------- 1 | package de.devsurf.injection.guice.serviceloader; 2 | 3 | import java.lang.reflect.Array; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | import java.util.ServiceLoader; 7 | 8 | import javax.inject.Inject; 9 | 10 | import com.google.inject.Injector; 11 | import com.google.inject.Provider; 12 | 13 | public final class MultiServiceLoaderProvider implements Provider { 14 | 15 | private final Class type; 16 | 17 | @Inject 18 | Injector injector; 19 | 20 | public MultiServiceLoaderProvider(Class type) { 21 | this.type = type; 22 | } 23 | 24 | /* 25 | * Generated classes can't be used with AOP, because only instances created 26 | * by Guice are extended with AOP. Maybe this will be fixed later in Guice. 27 | * @see com.google.inject.Provider#get() 28 | */ 29 | @SuppressWarnings( { "unchecked" }) 30 | @Override 31 | public T[] get() { 32 | List instances = new ArrayList(); 33 | ServiceLoader services = ServiceLoader.load(type); 34 | 35 | for(T t : services){ 36 | injector.injectMembers(t); 37 | instances.add(t); 38 | } 39 | 40 | return instances.toArray((T[]) Array.newInstance(type, instances.size())); 41 | } 42 | 43 | public static Provider of(Class type) { 44 | return new MultiServiceLoaderProvider(type); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/serviceloader/ServiceLoaderFeature.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * 18 | */ 19 | package de.devsurf.injection.guice.serviceloader; 20 | 21 | import java.lang.annotation.Annotation; 22 | import java.util.Map; 23 | 24 | import javax.inject.Singleton; 25 | 26 | import de.devsurf.injection.guice.install.BindingStage; 27 | import de.devsurf.injection.guice.scanner.features.BindingScannerFeature; 28 | 29 | @Singleton 30 | public class ServiceLoaderFeature extends BindingScannerFeature { 31 | @Override 32 | public BindingStage accept(Class annotatedClass, Map annotations) { 33 | return BindingStage.IGNORE; 34 | } 35 | 36 | @Override 37 | public void process(final Class annotatedClass, 38 | final Map annotations) { 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/serviceloader/ServiceLoaderModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.serviceloader; 17 | 18 | import java.util.Set; 19 | 20 | import javax.inject.Inject; 21 | 22 | import com.google.inject.Module; 23 | 24 | import de.devsurf.injection.guice.scanner.features.ScannerFeature; 25 | 26 | //@GuiceModule(stage=BindingStage.INTERNAL) 27 | public class ServiceLoaderModule extends ModuleLoader { 28 | private boolean enabled; 29 | 30 | public ServiceLoaderModule(Class type) { 31 | super(type); 32 | } 33 | 34 | @Inject 35 | public void init(Set features){ 36 | for(ScannerFeature feature : features){ 37 | if(feature instanceof ServiceLoaderFeature){ 38 | enabled = true; 39 | } 40 | } 41 | } 42 | 43 | @Override 44 | protected void configure() { 45 | if(enabled){ 46 | super.configure(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /core/src/main/java/de/devsurf/injection/guice/serviceloader/SingleServiceLoaderProvider.java: -------------------------------------------------------------------------------- 1 | package de.devsurf.injection.guice.serviceloader; 2 | 3 | import java.util.Iterator; 4 | import java.util.ServiceLoader; 5 | 6 | import javax.inject.Inject; 7 | 8 | import com.google.inject.Provider; 9 | 10 | public final class SingleServiceLoaderProvider implements Provider { 11 | 12 | private final Class type; 13 | 14 | @Inject 15 | com.google.inject.Injector injector; 16 | 17 | public SingleServiceLoaderProvider(Class type) { 18 | this.type = type; 19 | } 20 | 21 | /* 22 | * Generated classes can't be used with AOP, because only instances created 23 | * by Guice are extended with AOP. Maybe this will be fixed later in Guice. 24 | * @see com.google.inject.Provider#get() 25 | */ 26 | @Override 27 | public T get() { 28 | ServiceLoader services = ServiceLoader.load(type); 29 | 30 | Iterator iterator = services.iterator(); 31 | if(iterator.hasNext()){ 32 | T instance = iterator.next(); 33 | injector.injectMembers(instance); 34 | return instance; 35 | } 36 | 37 | return null; 38 | } 39 | 40 | public static Provider of(Class type) { 41 | return new SingleServiceLoaderProvider(type); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /core/src/test/resources/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /core/src/test/resources/conf/startup.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | default_value 5 | 6 | -------------------------------------------------------------------------------- /etc/header.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) ${year} ${owner} <${email}> 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/aop/example/interceptor/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.aop.example.interceptor; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | 27 | String convert(String message, boolean enabled, int times); 28 | } 29 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/aop/example/interceptor/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.aop.example.interceptor; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.aop.Intercept; 20 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 21 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 22 | 23 | /** 24 | * This class implements the Example interface and uses the {@link Bind}- 25 | * Annotation, so it will be recognized by the {@link ClasspathScanner}. In this 26 | * Example the {@link ASMClasspathScanner} is used. 27 | * 28 | * @author Daniel Manzke 29 | * 30 | */ 31 | @Bind 32 | public class ExampleImpl implements Example { 33 | @Override 34 | @Intercept 35 | public String sayHello() { 36 | return "yeahhh!!!"; 37 | } 38 | 39 | @Override 40 | @Intercept 41 | public String convert(String message, boolean enabled, int times) { 42 | if (enabled) { 43 | String part = message; 44 | for (int i = 0; i < times; i++) { 45 | message += part; 46 | } 47 | } 48 | return message; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/aop/example/interceptor/InvalidMethodInterceptor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.aop.example.interceptor; 17 | 18 | import java.lang.reflect.Method; 19 | 20 | import javax.interceptor.Interceptor; 21 | 22 | import org.aopalliance.intercept.MethodInvocation; 23 | 24 | import com.google.inject.matcher.Matcher; 25 | import com.google.inject.matcher.Matchers; 26 | 27 | import de.devsurf.injection.guice.aop.ClassMatcher; 28 | import de.devsurf.injection.guice.aop.Intercept; 29 | import de.devsurf.injection.guice.aop.Invoke; 30 | import de.devsurf.injection.guice.aop.MethodMatcher; 31 | 32 | @Interceptor 33 | public class InvalidMethodInterceptor { 34 | 35 | @Invoke 36 | public Object invoke(MethodInvocation invocation, Object obj) throws Throwable { 37 | return invocation.proceed(); 38 | } 39 | 40 | @ClassMatcher 41 | public Matcher> getClassMatcher() { 42 | return Matchers.any(); 43 | } 44 | 45 | @MethodMatcher 46 | public Matcher getMethodMatcher() { 47 | return Matchers.annotatedWith(Intercept.class); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/commons/general/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.commons.general; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/commons/general/ExampleConfiguration.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.commons.general; 17 | 18 | import javax.inject.Named; 19 | 20 | import org.apache.commons.configuration.plist.PropertyListConfiguration; 21 | 22 | import de.devsurf.injection.guice.configuration.Configuration; 23 | import de.devsurf.injection.guice.configuration.PathConfig; 24 | 25 | @Configuration(name = @Named("config"), location = @PathConfig(value = "/configuration.plist"), to = PropertyListConfiguration.class) 26 | public interface ExampleConfiguration { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/commons/general/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.commons.general; 17 | 18 | import org.apache.commons.configuration.Configuration; 19 | 20 | import com.google.inject.Inject; 21 | import javax.inject.Named; 22 | 23 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 24 | 25 | /** 26 | * This class implements the Example interface and is not annotated like the 27 | * other Examples, due the fact, that the {@link ExampleModule} will bind it 28 | * manually. In this Example the {@link ASMClasspathScanner} is used, to find 29 | * the {@link ExampleModule} and automatically install it. 30 | * 31 | * @author Daniel Manzke 32 | * 33 | */ 34 | public class ExampleImpl implements Example { 35 | @Inject 36 | @Named("config") 37 | private Configuration config; 38 | 39 | @Override 40 | public String sayHello() { 41 | return "sayHello() - " + config.getString("de.devsurf.configuration.message"); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/commons/general/ExampleModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.commons.general; 17 | 18 | import com.google.inject.AbstractModule; 19 | 20 | import de.devsurf.injection.guice.annotations.GuiceModule; 21 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 22 | 23 | /** 24 | * This is a GuiceModule, which bind the {@link ExampleImpl} to the 25 | * {@link Example} interface and it will be recognized by the 26 | * {@link ASMClasspathScanner}, due the fact that it is annotated with the 27 | * {@link GuiceModule}. 28 | * 29 | * @author Daniel Manzke 30 | * 31 | */ 32 | @GuiceModule 33 | public class ExampleModule extends AbstractModule { 34 | @Override 35 | protected void configure() { 36 | bind(Example.class).to(ExampleImpl.class); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/commons/plist/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.commons.plist; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/commons/plist/ExampleConfiguration.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.commons.plist; 17 | 18 | import org.apache.commons.configuration.plist.PropertyListConfiguration; 19 | 20 | import javax.inject.Named; 21 | 22 | import de.devsurf.injection.guice.configuration.Configuration; 23 | import de.devsurf.injection.guice.configuration.PathConfig; 24 | 25 | @Configuration(name = @Named("config"), location = @PathConfig(value = "/configuration.plist"), to = PropertyListConfiguration.class) 26 | public interface ExampleConfiguration { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/commons/plist/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.commons.plist; 17 | 18 | import org.apache.commons.configuration.plist.PropertyListConfiguration; 19 | 20 | import com.google.inject.Inject; 21 | import javax.inject.Named; 22 | 23 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 24 | 25 | /** 26 | * This class implements the Example interface and is not annotated like the 27 | * other Examples, due the fact, that the {@link ExampleModule} will bind it 28 | * manually. In this Example the {@link ASMClasspathScanner} is used, to find 29 | * the {@link ExampleModule} and automatically install it. 30 | * 31 | * @author Daniel Manzke 32 | * 33 | */ 34 | public class ExampleImpl implements Example { 35 | @Inject 36 | @Named("config") 37 | private PropertyListConfiguration config; 38 | 39 | @Override 40 | public String sayHello() { 41 | return "sayHello() - " + config.getString("de.devsurf.configuration.message"); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/commons/plist/ExampleModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.commons.plist; 17 | 18 | import com.google.inject.AbstractModule; 19 | 20 | import de.devsurf.injection.guice.annotations.GuiceModule; 21 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 22 | 23 | /** 24 | * This is a GuiceModule, which bind the {@link ExampleImpl} to the 25 | * {@link Example} interface and it will be recognized by the 26 | * {@link ASMClasspathScanner}, due the fact that it is annotated with the 27 | * {@link GuiceModule}. 28 | * 29 | * @author Daniel Manzke 30 | * 31 | */ 32 | @GuiceModule 33 | public class ExampleModule extends AbstractModule { 34 | @Override 35 | protected void configure() { 36 | bind(Example.class).to(ExampleImpl.class); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/map/dynamic/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.map.dynamic; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/map/dynamic/ExampleConfiguration.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.map.dynamic; 17 | 18 | import javax.inject.Named; 19 | 20 | import de.devsurf.injection.guice.configuration.Configuration; 21 | import de.devsurf.injection.guice.configuration.PathConfig; 22 | 23 | @Configuration(name = @Named("config"), location = @PathConfig(value = "${myconfig}")) 24 | public interface ExampleConfiguration { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/map/dynamic/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.map.dynamic; 17 | 18 | import java.util.Properties; 19 | 20 | import com.google.inject.Inject; 21 | import javax.inject.Named; 22 | 23 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 24 | 25 | /** 26 | * This class implements the Example interface and is not annotated like the 27 | * other Examples, due the fact, that the {@link ExampleModule} will bind it 28 | * manually. In this Example the {@link ASMClasspathScanner} is used, to find 29 | * the {@link ExampleModule} and automatically install it. 30 | * 31 | * @author Daniel Manzke 32 | * 33 | */ 34 | public class ExampleImpl implements Example { 35 | @Inject 36 | @Named("config") 37 | private Properties config; 38 | 39 | @Override 40 | public String sayHello() { 41 | return "sayHello() - " + config.getProperty("message"); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/map/dynamic/ExampleModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.map.dynamic; 17 | 18 | import com.google.inject.AbstractModule; 19 | 20 | import de.devsurf.injection.guice.annotations.GuiceModule; 21 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 22 | 23 | /** 24 | * This is a GuiceModule, which bind the {@link ExampleImpl} to the 25 | * {@link Example} interface and it will be recognized by the 26 | * {@link ASMClasspathScanner}, due the fact that it is annotated with the 27 | * {@link GuiceModule}. 28 | * 29 | * @author Daniel Manzke 30 | * 31 | */ 32 | @GuiceModule 33 | public class ExampleModule extends AbstractModule { 34 | @Override 35 | protected void configure() { 36 | bind(Example.class).to(ExampleImpl.class); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/map/general/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.map.general; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/map/general/ExampleConfiguration.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.map.general; 17 | 18 | import de.devsurf.injection.guice.configuration.Configuration; 19 | import de.devsurf.injection.guice.configuration.PathConfig; 20 | 21 | @Configuration(location = @PathConfig(value = "/configuration.properties")) 22 | public interface ExampleConfiguration { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/map/general/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.map.general; 17 | 18 | import java.util.Properties; 19 | 20 | import com.google.inject.Inject; 21 | 22 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 23 | 24 | /** 25 | * This class implements the Example interface and is not annotated like the 26 | * other Examples, due the fact, that the {@link ExampleModule} will bind it 27 | * manually. In this Example the {@link ASMClasspathScanner} is used, to find 28 | * the {@link ExampleModule} and automatically install it. 29 | * 30 | * @author Daniel Manzke 31 | * 32 | */ 33 | public class ExampleImpl implements Example { 34 | @Inject 35 | private Properties config; 36 | 37 | @Override 38 | public String sayHello() { 39 | return "sayHello() - " + config.getProperty("message"); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/map/general/ExampleModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.map.general; 17 | 18 | import com.google.inject.AbstractModule; 19 | 20 | import de.devsurf.injection.guice.annotations.GuiceModule; 21 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 22 | 23 | /** 24 | * This is a GuiceModule, which bind the {@link ExampleImpl} to the 25 | * {@link Example} interface and it will be recognized by the 26 | * {@link ASMClasspathScanner}, due the fact that it is annotated with the 27 | * {@link GuiceModule}. 28 | * 29 | * @author Daniel Manzke 30 | * 31 | */ 32 | @GuiceModule 33 | public class ExampleModule extends AbstractModule { 34 | @Override 35 | protected void configure() { 36 | bind(Example.class).to(ExampleImpl.class); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/map/lazy/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.map.lazy; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/map/lazy/ExampleConfiguration.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.map.lazy; 17 | 18 | import de.devsurf.injection.guice.configuration.Configuration; 19 | import de.devsurf.injection.guice.configuration.PathConfig; 20 | 21 | @Configuration(location = @PathConfig(value = "/configuration.properties"), lazy = true) 22 | public interface ExampleConfiguration { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/map/lazy/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.map.lazy; 17 | 18 | import java.util.Properties; 19 | 20 | import com.google.inject.Inject; 21 | 22 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 23 | 24 | /** 25 | * This class implements the Example interface and is not annotated like the 26 | * other Examples, due the fact, that the {@link ExampleModule} will bind it 27 | * manually. In this Example the {@link ASMClasspathScanner} is used, to find 28 | * the {@link ExampleModule} and automatically install it. 29 | * 30 | * @author Daniel Manzke 31 | * 32 | */ 33 | public class ExampleImpl implements Example { 34 | @Inject 35 | private Properties config; 36 | 37 | @Override 38 | public String sayHello() { 39 | return "sayHello() - " + config.getProperty("message"); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/map/lazy/ExampleModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.map.lazy; 17 | 18 | import com.google.inject.AbstractModule; 19 | 20 | import de.devsurf.injection.guice.annotations.GuiceModule; 21 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 22 | 23 | /** 24 | * This is a GuiceModule, which bind the {@link ExampleImpl} to the 25 | * {@link Example} interface and it will be recognized by the 26 | * {@link ASMClasspathScanner}, due the fact that it is annotated with the 27 | * {@link GuiceModule}. 28 | * 29 | * @author Daniel Manzke 30 | * 31 | */ 32 | @GuiceModule 33 | public class ExampleModule extends AbstractModule { 34 | @Override 35 | protected void configure() { 36 | bind(Example.class).to(ExampleImpl.class); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/map/named/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.map.named; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/map/named/ExampleConfiguration.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.map.named; 17 | 18 | import javax.inject.Named; 19 | 20 | import de.devsurf.injection.guice.configuration.Configuration; 21 | import de.devsurf.injection.guice.configuration.PathConfig; 22 | 23 | @Configuration(name = @Named("config"), location = @PathConfig(value = "/configuration.properties")) 24 | public interface ExampleConfiguration { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/map/named/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.map.named; 17 | 18 | import java.util.Properties; 19 | 20 | import com.google.inject.Inject; 21 | import javax.inject.Named; 22 | 23 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 24 | 25 | /** 26 | * This class implements the Example interface and is not annotated like the 27 | * other Examples, due the fact, that the {@link ExampleModule} will bind it 28 | * manually. In this Example the {@link ASMClasspathScanner} is used, to find 29 | * the {@link ExampleModule} and automatically install it. 30 | * 31 | * @author Daniel Manzke 32 | * 33 | */ 34 | public class ExampleImpl implements Example { 35 | @Inject 36 | @Named("config") 37 | private Properties config; 38 | 39 | @Override 40 | public String sayHello() { 41 | return "sayHello() - " + config.getProperty("message"); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/configuration/example/map/named/ExampleModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.configuration.example.map.named; 17 | 18 | import com.google.inject.AbstractModule; 19 | 20 | import de.devsurf.injection.guice.annotations.GuiceModule; 21 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 22 | 23 | /** 24 | * This is a GuiceModule, which bind the {@link ExampleImpl} to the 25 | * {@link Example} interface and it will be recognized by the 26 | * {@link ASMClasspathScanner}, due the fact that it is annotated with the 27 | * {@link GuiceModule}. 28 | * 29 | * @author Daniel Manzke 30 | * 31 | */ 32 | @GuiceModule 33 | public class ExampleModule extends AbstractModule { 34 | @Override 35 | protected void configure() { 36 | bind(Example.class).to(ExampleImpl.class); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/example/starter/ExampleApplication.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.example.starter; 17 | 18 | public interface ExampleApplication extends Runnable { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/example/starter/ExampleStarter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.example.starter; 17 | 18 | import java.util.Set; 19 | 20 | import com.google.inject.Guice; 21 | import com.google.inject.Injector; 22 | import com.google.inject.Key; 23 | import com.google.inject.TypeLiteral; 24 | 25 | import de.devsurf.injection.guice.scanner.PackageFilter; 26 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 27 | 28 | public class ExampleStarter { 29 | public static void main(String[] args) { 30 | Injector injector = Guice.createInjector(new ExampleStartupModule(ASMClasspathScanner.class, PackageFilter.create("de.devsurf.injection.guice"))); 31 | 32 | Key> key = Key.get(new TypeLiteral>() { 33 | }); 34 | Set apps = injector.getInstance(key); 35 | for (ExampleApplication app : apps) { 36 | System.out.println("Starting App: " + app.getClass().getName()); 37 | app.run(); 38 | System.out.println(); 39 | } 40 | System.out.println("Run " + apps.size() + " Applications."); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/integrations/example/guicy/automodule/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.integrations.example.guicy.automodule; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | 27 | void inform(); 28 | } 29 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/integrations/example/guicy/automodule/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.integrations.example.guicy.automodule; 17 | 18 | import javax.annotation.PostConstruct; 19 | 20 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 21 | 22 | /** 23 | * This class implements the Example interface and is not annotated like the 24 | * other Examples, due the fact, that the {@link ExampleModule} will bind it 25 | * manually. In this Example the {@link ASMClasspathScanner} is used, to find 26 | * the {@link ExampleModule} and automatically install it. 27 | * 28 | * @author Daniel Manzke 29 | * 30 | */ 31 | public class ExampleImpl implements Example { 32 | @PostConstruct 33 | public void inform() { 34 | System.out.println("inform about post construction!"); 35 | } 36 | 37 | @Override 38 | public String sayHello() { 39 | return "yeahhh!!!"; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/integrations/example/guicy/automodule/ExampleModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.integrations.example.guicy.automodule; 17 | 18 | import com.google.inject.AbstractModule; 19 | 20 | import de.devsurf.injection.guice.annotations.GuiceModule; 21 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 22 | 23 | /** 24 | * This is a GuiceModule, which bind the {@link ExampleImpl} to the 25 | * {@link Example} interface and it will be recognized by the 26 | * {@link ASMClasspathScanner}, due the fact that it is annotated with the 27 | * {@link GuiceModule}. 28 | * 29 | * @author Daniel Manzke 30 | * 31 | */ 32 | @GuiceModule 33 | public class ExampleModule extends AbstractModule { 34 | @Override 35 | protected void configure() { 36 | bind(Example.class).to(ExampleImpl.class); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/integrations/example/guicy/jndi/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.integrations.example.guicy.jndi; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | 27 | void inform(); 28 | } 29 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/integrations/example/guicy/jndi/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.integrations.example.guicy.jndi; 17 | 18 | import javax.annotation.PostConstruct; 19 | 20 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 21 | 22 | /** 23 | * This class implements the Example interface and is not annotated like the 24 | * other Examples, due the fact, that the {@link ExampleModule} will bind it 25 | * manually. In this Example the {@link ASMClasspathScanner} is used, to find 26 | * the {@link ExampleModule} and automatically install it. 27 | * 28 | * @author Daniel Manzke 29 | * 30 | */ 31 | public class ExampleImpl implements Example { 32 | @PostConstruct 33 | public void inform() { 34 | System.out.println("inform about post construction!"); 35 | } 36 | 37 | @Override 38 | public String sayHello() { 39 | return "yeahhh!!!"; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/integrations/example/guicy/jndi/ExampleModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.integrations.example.guicy.jndi; 17 | 18 | import com.google.inject.AbstractModule; 19 | 20 | import de.devsurf.injection.guice.annotations.GuiceModule; 21 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 22 | 23 | /** 24 | * This is a GuiceModule, which bind the {@link ExampleImpl} to the 25 | * {@link Example} interface and it will be recognized by the 26 | * {@link ASMClasspathScanner}, due the fact that it is annotated with the 27 | * {@link GuiceModule}. 28 | * 29 | * @author Daniel Manzke 30 | * 31 | */ 32 | @GuiceModule 33 | public class ExampleModule extends AbstractModule { 34 | @Override 35 | protected void configure() { 36 | bind(Example.class).to(ExampleImpl.class); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/integrations/example/rocoto/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.integrations.example.rocoto; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/integrations/example/rocoto/ExampleConfiguration.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.integrations.example.rocoto; 17 | 18 | import de.devsurf.injection.guice.configuration.Configuration; 19 | import de.devsurf.injection.guice.configuration.Configuration.Type; 20 | import de.devsurf.injection.guice.configuration.PathConfig; 21 | 22 | @Configuration(location = @PathConfig(value = "/configuration.properties"), type = Type.VALUES) 23 | public interface ExampleConfiguration { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/integrations/example/rocoto/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.integrations.example.rocoto; 17 | 18 | import com.google.inject.Inject; 19 | import javax.inject.Named; 20 | 21 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 22 | 23 | /** 24 | * This class implements the Example interface and is not annotated like the 25 | * other Examples, due the fact, that the {@link ExampleModule} will bind it 26 | * manually. In this Example the {@link ASMClasspathScanner} is used, to find 27 | * the {@link ExampleModule} and automatically install it. 28 | * 29 | * @author Daniel Manzke 30 | * 31 | */ 32 | public class ExampleImpl implements Example { 33 | @Inject 34 | @Named("message") 35 | private String message; 36 | 37 | @Override 38 | public String sayHello() { 39 | return "sayHello() - " + message; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/integrations/example/rocoto/ExampleModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.integrations.example.rocoto; 17 | 18 | import com.google.inject.AbstractModule; 19 | 20 | import de.devsurf.injection.guice.annotations.GuiceModule; 21 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 22 | 23 | /** 24 | * This is a GuiceModule, which bind the {@link ExampleImpl} to the 25 | * {@link Example} interface and it will be recognized by the 26 | * {@link ASMClasspathScanner}, due the fact that it is annotated with the 27 | * {@link GuiceModule}. 28 | * 29 | * @author Daniel Manzke 30 | * 31 | */ 32 | @GuiceModule 33 | public class ExampleModule extends AbstractModule { 34 | @Override 35 | protected void configure() { 36 | bind(Example.class).to(ExampleImpl.class); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/autobind/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.autobind; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/autobind/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.autobind; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 20 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 21 | 22 | /** 23 | * This class implements the Example interface and uses the {@link Bind}- 24 | * Annotation, so it will be recognized by the {@link ClasspathScanner}. In this 25 | * Example the {@link ASMClasspathScanner} is used. 26 | * 27 | * @author Daniel Manzke 28 | * 29 | */ 30 | @Bind 31 | public class ExampleImpl implements Example { 32 | @Override 33 | public String sayHello() { 34 | return "yeahhh!!!"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/autobind/inherited/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.autobind.inherited; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/autobind/inherited/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.autobind.inherited; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 20 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 21 | 22 | /** 23 | * This class implements the Example interface and uses the {@link Bind}- 24 | * Annotation, so it will be recognized by the {@link ClasspathScanner}. In this 25 | * Example the {@link ASMClasspathScanner} is used. 26 | * 27 | * @author Daniel Manzke 28 | * 29 | */ 30 | @Bind 31 | public class ExampleImpl implements Example { 32 | @Override 33 | public String sayHello() { 34 | return "yeahhh!!!"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/autobind/inherited/InheritedExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.autobind.inherited; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 20 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 21 | 22 | /** 23 | * This class implements the Example interface and uses the {@link Bind}- 24 | * Annotation, so it will be recognized by the {@link ClasspathScanner}. In this 25 | * Example the {@link ASMClasspathScanner} is used. 26 | * 27 | * @author Daniel Manzke 28 | * 29 | */ 30 | public class InheritedExampleImpl extends ExampleImpl { 31 | @Override 32 | public String sayHello() { 33 | return "yeahhh I'm inherited!!!"; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/autobind/marker/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.autobind.marker; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/autobind/marker/FirstImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.autobind.marker; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 20 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 21 | 22 | /** 23 | * This class implements the Example interface and uses the {@link Bind}- 24 | * Annotation, so it will be recognized by the {@link ClasspathScanner}. In this 25 | * Example the {@link ASMClasspathScanner} is used. 26 | * 27 | * @author Daniel Manzke 28 | * 29 | */ 30 | @Bind 31 | @FirstMarker 32 | public class FirstImpl implements Example { 33 | @Override 34 | public String sayHello() { 35 | return "first - yeahhh!!!"; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/autobind/marker/FirstMarker.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.autobind.marker; 17 | 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | import com.google.inject.BindingAnnotation; 24 | 25 | @Retention(RetentionPolicy.RUNTIME) 26 | @BindingAnnotation 27 | @Target( { ElementType.TYPE }) 28 | public @interface FirstMarker { 29 | 30 | } 31 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/autobind/marker/SecondImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.autobind.marker; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 20 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 21 | 22 | /** 23 | * This class implements the Example interface and uses the {@link Bind}- 24 | * Annotation, so it will be recognized by the {@link ClasspathScanner}. In this 25 | * Example the {@link ASMClasspathScanner} is used. 26 | * 27 | * @author Daniel Manzke 28 | * 29 | */ 30 | @Bind 31 | @SecondMarker 32 | public class SecondImpl implements Example { 33 | @Override 34 | public String sayHello() { 35 | return "second - yeahhh!!!"; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/autobind/marker/SecondMarker.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.autobind.marker; 17 | 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | import com.google.inject.BindingAnnotation; 24 | 25 | @Retention(RetentionPolicy.RUNTIME) 26 | @BindingAnnotation 27 | @Target( { ElementType.TYPE }) 28 | public @interface SecondMarker { 29 | 30 | } 31 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/autobind/multiple/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.autobind.multiple; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/autobind/multiple/ExampleContainer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.autobind.multiple; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | import java.util.Set; 21 | 22 | import com.google.inject.Inject; 23 | 24 | public class ExampleContainer { 25 | private List _examples; 26 | 27 | @Inject 28 | public ExampleContainer(Set example) { 29 | _examples = new ArrayList(example); 30 | } 31 | 32 | public void sayHello() { 33 | for (Example example : _examples) { 34 | System.out.println(example.sayHello()); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/autobind/multiple/ExampleOneImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.autobind.multiple; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 20 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 21 | 22 | /** 23 | * This class implements the Example interface and uses the {@link Bind}- 24 | * Annotation, so it will be recognized by the {@link ClasspathScanner} and 25 | * bound to the Name "Example". In this Example the {@link ASMClasspathScanner} 26 | * is used. 27 | * 28 | * @author Daniel Manzke 29 | * 30 | */ 31 | 32 | @Bind(multiple = true) 33 | public class ExampleOneImpl implements Example { 34 | @Override 35 | public String sayHello() { 36 | return "one - yeahhh!!!"; 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/autobind/multiple/ExampleTwoImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.autobind.multiple; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 20 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 21 | 22 | /** 23 | * This class implements the Example interface and uses the {@link Bind}- 24 | * Annotation, so it will be recognized by the {@link ClasspathScanner} and 25 | * bound to the Name "Example". In this Example the {@link ASMClasspathScanner} 26 | * is used. 27 | * 28 | * @author Daniel Manzke 29 | * 30 | */ 31 | @Bind(multiple = true) 32 | public class ExampleTwoImpl implements Example { 33 | @Override 34 | public String sayHello() { 35 | return "two - yeahhh!!!"; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/autobind/names/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.autobind.names; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/autobind/names/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.autobind.names; 17 | 18 | import javax.inject.Named; 19 | 20 | import de.devsurf.injection.guice.annotations.Bind; 21 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 22 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 23 | 24 | /** 25 | * This class implements the Example interface and uses the {@link Bind}- 26 | * Annotation, so it will be recognized by the {@link ClasspathScanner} and 27 | * bound to the Name "Example". In this Example the {@link ASMClasspathScanner} 28 | * is used. 29 | * 30 | * @author Daniel Manzke 31 | * 32 | */ 33 | @Bind 34 | @Named("Example") 35 | public class ExampleImpl implements Example { 36 | @Override 37 | public String sayHello() { 38 | return "yeahhh!!!"; 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/automodule/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.automodule; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/automodule/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.automodule; 17 | 18 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 19 | 20 | /** 21 | * This class implements the Example interface and is not annotated like the 22 | * other Examples, due the fact, that the {@link ExampleModule} will bind it 23 | * manually. In this Example the {@link ASMClasspathScanner} is used, to find 24 | * the {@link ExampleModule} and automatically install it. 25 | * 26 | * @author Daniel Manzke 27 | * 28 | */ 29 | public class ExampleImpl implements Example { 30 | @Override 31 | public String sayHello() { 32 | return "yeahhh!!!"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/automodule/ExampleModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.automodule; 17 | 18 | import com.google.inject.AbstractModule; 19 | 20 | import de.devsurf.injection.guice.annotations.GuiceModule; 21 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 22 | 23 | /** 24 | * This is a GuiceModule, which bind the {@link ExampleImpl} to the 25 | * {@link Example} interface and it will be recognized by the 26 | * {@link ASMClasspathScanner}, due the fact that it is annotated with the 27 | * {@link GuiceModule}. 28 | * 29 | * @author Daniel Manzke 30 | * 31 | */ 32 | @GuiceModule 33 | public class ExampleModule extends AbstractModule { 34 | @Override 35 | protected void configure() { 36 | bind(Example.class).to(ExampleImpl.class); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/startupmodule/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.startupmodule; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/startupmodule/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.startupmodule; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 20 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 21 | 22 | /** 23 | * This class implements the Example interface and uses the {@link Bind}- 24 | * Annotation, so it will be recognized by the {@link ClasspathScanner} and 25 | * bound to the Name "Example". In this Example the {@link ASMClasspathScanner} 26 | * is used. 27 | * 28 | * @author Daniel Manzke 29 | * 30 | */ 31 | @Bind 32 | public class ExampleImpl implements Example { 33 | @Override 34 | public String sayHello() { 35 | return "yeahhh!!!"; 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/asm/example/startupmodule/ExampleModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.example.startupmodule; 17 | 18 | import com.google.inject.AbstractModule; 19 | 20 | import de.devsurf.injection.guice.annotations.GuiceModule; 21 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 22 | 23 | /** 24 | * This is a GuiceModule, which bind the {@link ExampleImpl} to the 25 | * {@link Example} interface and it will be recognized by the 26 | * {@link ASMClasspathScanner}, due the fact that it is annotated with the 27 | * {@link GuiceModule}. 28 | * 29 | * @author Daniel Manzke 30 | * 31 | */ 32 | @GuiceModule 33 | public class ExampleModule extends AbstractModule { 34 | @Override 35 | protected void configure() { 36 | bind(Example.class).to(ExampleImpl.class); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/reflections/example/autobind/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.reflections.example.autobind; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/reflections/example/autobind/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.reflections.example.autobind; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 20 | import de.devsurf.injection.guice.scanner.reflections.ReflectionsScanner; 21 | 22 | /** 23 | * This class implements the Example interface and uses the {@link Bind}- 24 | * Annotation, so it will be recognized by the {@link ClasspathScanner}. In this 25 | * Example the {@link ReflectionsScanner} is used. 26 | * 27 | * @author Daniel Manzke 28 | * 29 | */ 30 | @Bind 31 | public class ExampleImpl implements Example { 32 | @Override 33 | public String sayHello() { 34 | return "yeahhh!!!"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/reflections/example/autobind/multiple/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.reflections.example.autobind.multiple; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/reflections/example/autobind/multiple/ExampleContainer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.reflections.example.autobind.multiple; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | import java.util.Set; 21 | 22 | import com.google.inject.Inject; 23 | 24 | public class ExampleContainer { 25 | private List _examples; 26 | 27 | @Inject 28 | public ExampleContainer(Set example) { 29 | _examples = new ArrayList(example); 30 | } 31 | 32 | public void sayHello() { 33 | for (Example example : _examples) { 34 | System.out.println(example.sayHello()); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/reflections/example/autobind/multiple/ExampleOneImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.reflections.example.autobind.multiple; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 20 | import de.devsurf.injection.guice.scanner.reflections.ReflectionsScanner; 21 | 22 | /** 23 | * This class implements the Example interface and uses the {@link Bind}- 24 | * Annotation, so it will be recognized by the {@link ClasspathScanner} and 25 | * bound to the Name "Example". In this Example the {@link ReflectionsScanner} 26 | * is used. 27 | * 28 | * @author Daniel Manzke 29 | * 30 | */ 31 | @Bind(multiple = true) 32 | public class ExampleOneImpl implements Example { 33 | @Override 34 | public String sayHello() { 35 | return "one - yeahhh!!!"; 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/reflections/example/autobind/multiple/ExampleTwoImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.reflections.example.autobind.multiple; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 20 | import de.devsurf.injection.guice.scanner.reflections.ReflectionsScanner; 21 | 22 | /** 23 | * This class implements the Example interface and uses the {@link Bind}- 24 | * Annotation, so it will be recognized by the {@link ClasspathScanner} and 25 | * bound to the Name "Example". In this Example the {@link ReflectionsScanner} 26 | * is used. 27 | * 28 | * @author Daniel Manzke 29 | * 30 | */ 31 | @Bind(multiple = true) 32 | public class ExampleTwoImpl implements Example { 33 | @Override 34 | public String sayHello() { 35 | return "two - yeahhh!!!"; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/reflections/example/autobind/names/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.reflections.example.autobind.names; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/reflections/example/autobind/names/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.reflections.example.autobind.names; 17 | 18 | import javax.inject.Named; 19 | 20 | import de.devsurf.injection.guice.annotations.Bind; 21 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 22 | import de.devsurf.injection.guice.scanner.reflections.ReflectionsScanner; 23 | 24 | /** 25 | * This class implements the Example interface and uses the {@link Bind}- 26 | * Annotation, so it will be recognized by the {@link ClasspathScanner} and 27 | * bound to the Name "Example". In this Example the {@link ReflectionsScanner} 28 | * is used. 29 | * 30 | * @author Daniel Manzke 31 | * 32 | */ 33 | @Bind 34 | @Named("Example") 35 | public class ExampleImpl implements Example { 36 | @Override 37 | public String sayHello() { 38 | return "yeahhh!!!"; 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/reflections/example/automodule/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.reflections.example.automodule; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/reflections/example/automodule/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.reflections.example.automodule; 17 | 18 | import de.devsurf.injection.guice.scanner.reflections.ReflectionsScanner; 19 | 20 | /** 21 | * This class implements the Example interface and is not annotated like the 22 | * other Examples, due the fact, that the {@link ExampleModule} will bind it 23 | * manually. In this Example the {@link ReflectionsScanner} is used, to find the 24 | * {@link ExampleModule} and automatically install it. 25 | * 26 | * @author Daniel Manzke 27 | * 28 | */ 29 | public class ExampleImpl implements Example { 30 | @Override 31 | public String sayHello() { 32 | return "yeahhh!!!"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/reflections/example/automodule/ExampleModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.reflections.example.automodule; 17 | 18 | import com.google.inject.AbstractModule; 19 | 20 | import de.devsurf.injection.guice.annotations.GuiceModule; 21 | import de.devsurf.injection.guice.scanner.reflections.ReflectionsScanner; 22 | 23 | /** 24 | * This is a GuiceModule, which bind the {@link ExampleImpl} to the 25 | * {@link Example} interface and it will be recognized by the 26 | * {@link ReflectionsScanner}, due the fact that it is annotated with the 27 | * {@link GuiceModule}. 28 | * 29 | * @author Daniel Manzke 30 | * 31 | */ 32 | @GuiceModule 33 | public class ExampleModule extends AbstractModule { 34 | @Override 35 | protected void configure() { 36 | bind(Example.class).to(ExampleImpl.class); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/reflections/example/startupmodule/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.reflections.example.startupmodule; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/reflections/example/startupmodule/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.reflections.example.startupmodule; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 20 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 21 | 22 | /** 23 | * This class implements the Example interface and uses the {@link Bind}- 24 | * Annotation, so it will be recognized by the {@link ClasspathScanner} and 25 | * bound to the Name "Example". In this Example the {@link ASMClasspathScanner} 26 | * is used. 27 | * 28 | * @author Daniel Manzke 29 | * 30 | */ 31 | @Bind 32 | public class ExampleImpl implements Example { 33 | @Override 34 | public String sayHello() { 35 | return "yeahhh!!!"; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/reflections/example/startupmodule/ExampleModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.reflections.example.startupmodule; 17 | 18 | import com.google.inject.AbstractModule; 19 | 20 | import de.devsurf.injection.guice.annotations.GuiceModule; 21 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 22 | 23 | /** 24 | * This is a GuiceModule, which bind the {@link ExampleImpl} to the 25 | * {@link Example} interface and it will be recognized by the 26 | * {@link ASMClasspathScanner}, due the fact that it is annotated with the 27 | * {@link GuiceModule}. 28 | * 29 | * @author Daniel Manzke 30 | * 31 | */ 32 | @GuiceModule 33 | public class ExampleModule extends AbstractModule { 34 | @Override 35 | protected void configure() { 36 | bind(Example.class).to(ExampleImpl.class); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/sonatype/example/autobind/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.sonatype.example.autobind; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/sonatype/example/autobind/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.sonatype.example.autobind; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 20 | import de.devsurf.injection.guice.scanner.sonatype.SonatypeScanner; 21 | 22 | /** 23 | * This class implements the Example interface and uses the {@link Bind}- 24 | * Annotation, so it will be recognized by the {@link ClasspathScanner}. In this 25 | * Example the {@link SonatypeScanner} is used. 26 | * 27 | * @author Daniel Manzke 28 | * 29 | */ 30 | @Bind 31 | public class ExampleImpl implements Example { 32 | @Override 33 | public String sayHello() { 34 | return "yeahhh!!!"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/sonatype/example/autobind/multiple/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.sonatype.example.autobind.multiple; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/sonatype/example/autobind/multiple/ExampleContainer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.sonatype.example.autobind.multiple; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | import java.util.Set; 21 | 22 | import com.google.inject.Inject; 23 | 24 | public class ExampleContainer { 25 | private List _examples; 26 | 27 | @Inject 28 | public ExampleContainer(Set example) { 29 | _examples = new ArrayList(example); 30 | } 31 | 32 | public void sayHello() { 33 | for (Example example : _examples) { 34 | System.out.println(example.sayHello()); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/sonatype/example/autobind/multiple/ExampleOneImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.sonatype.example.autobind.multiple; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 20 | import de.devsurf.injection.guice.scanner.sonatype.SonatypeScanner; 21 | 22 | /** 23 | * This class implements the Example interface and uses the {@link Bind}- 24 | * Annotation, so it will be recognized by the {@link ClasspathScanner} and 25 | * bound to the Name "Example". In this Example the {@link SonatypeScanner} is 26 | * used. 27 | * 28 | * @author Daniel Manzke 29 | * 30 | */ 31 | @Bind(multiple = true) 32 | public class ExampleOneImpl implements Example { 33 | @Override 34 | public String sayHello() { 35 | return "one - yeahhh!!!"; 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/sonatype/example/autobind/multiple/ExampleTwoImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.sonatype.example.autobind.multiple; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 20 | import de.devsurf.injection.guice.scanner.sonatype.SonatypeScanner; 21 | 22 | /** 23 | * This class implements the Example interface and uses the {@link Bind}- 24 | * Annotation, so it will be recognized by the {@link ClasspathScanner} and 25 | * bound to the Name "Example". In this Example the {@link SonatypeScanner} is 26 | * used. 27 | * 28 | * @author Daniel Manzke 29 | * 30 | */ 31 | @Bind(multiple = true) 32 | public class ExampleTwoImpl implements Example { 33 | @Override 34 | public String sayHello() { 35 | return "two - yeahhh!!!"; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/sonatype/example/autobind/names/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.sonatype.example.autobind.names; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/sonatype/example/autobind/names/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.sonatype.example.autobind.names; 17 | 18 | import javax.inject.Named; 19 | 20 | import de.devsurf.injection.guice.annotations.Bind; 21 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 22 | import de.devsurf.injection.guice.scanner.sonatype.SonatypeScanner; 23 | 24 | /** 25 | * This class implements the Example interface and uses the {@link Bind}- 26 | * Annotation, so it will be recognized by the {@link ClasspathScanner} and 27 | * bound to the Name "Example". In this Example the {@link SonatypeScanner} is 28 | * used. 29 | * 30 | * @author Daniel Manzke 31 | * 32 | */ 33 | @Bind 34 | @Named("Example") 35 | public class ExampleImpl implements Example { 36 | @Override 37 | public String sayHello() { 38 | return "yeahhh!!!"; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/sonatype/example/automodule/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.sonatype.example.automodule; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/sonatype/example/automodule/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.sonatype.example.automodule; 17 | 18 | import de.devsurf.injection.guice.scanner.sonatype.SonatypeScanner; 19 | 20 | /** 21 | * This class implements the Example interface and is not annotated like the 22 | * other Examples, due the fact, that the {@link ExampleModule} will bind it 23 | * manually. In this Example the {@link SonatypeScanner} is used, to find the 24 | * {@link ExampleModule} and automatically install it. 25 | * 26 | * @author Daniel Manzke 27 | * 28 | */ 29 | public class ExampleImpl implements Example { 30 | @Override 31 | public String sayHello() { 32 | return "yeahhh!!!"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/sonatype/example/automodule/ExampleModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.sonatype.example.automodule; 17 | 18 | import com.google.inject.AbstractModule; 19 | 20 | import de.devsurf.injection.guice.annotations.GuiceModule; 21 | import de.devsurf.injection.guice.scanner.sonatype.SonatypeScanner; 22 | 23 | /** 24 | * This is a GuiceModule, which bind the {@link ExampleImpl} to the 25 | * {@link Example} interface and it will be recognized by the 26 | * {@link SonatypeScanner}, due the fact that it is annotated with the 27 | * {@link GuiceModule}. 28 | * 29 | * @author Daniel Manzke 30 | * 31 | */ 32 | @GuiceModule 33 | public class ExampleModule extends AbstractModule { 34 | @Override 35 | protected void configure() { 36 | bind(Example.class).to(ExampleImpl.class); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/sonatype/example/startupmodule/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.sonatype.example.startupmodule; 17 | 18 | /** 19 | * Interface which is used to bind an implementation too. 20 | * 21 | * @author Daniel Manzke 22 | * 23 | */ 24 | public interface Example { 25 | String sayHello(); 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/sonatype/example/startupmodule/ExampleImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.sonatype.example.startupmodule; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.ClasspathScanner; 20 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 21 | 22 | /** 23 | * This class implements the Example interface and uses the {@link Bind}- 24 | * Annotation, so it will be recognized by the {@link ClasspathScanner} and 25 | * bound to the Name "Example". In this Example the {@link ASMClasspathScanner} 26 | * is used. 27 | * 28 | * @author Daniel Manzke 29 | * 30 | */ 31 | @Bind 32 | public class ExampleImpl implements Example { 33 | @Override 34 | public String sayHello() { 35 | return "yeahhh!!!"; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /examples/src/main/java/de/devsurf/injection/guice/scanner/sonatype/example/startupmodule/ExampleModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.sonatype.example.startupmodule; 17 | 18 | import com.google.inject.AbstractModule; 19 | 20 | import de.devsurf.injection.guice.annotations.GuiceModule; 21 | import de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner; 22 | 23 | /** 24 | * This is a GuiceModule, which bind the {@link ExampleImpl} to the 25 | * {@link Example} interface and it will be recognized by the 26 | * {@link ASMClasspathScanner}, due the fact that it is annotated with the 27 | * {@link GuiceModule}. 28 | * 29 | * @author Daniel Manzke 30 | * 31 | */ 32 | @GuiceModule 33 | public class ExampleModule extends AbstractModule { 34 | @Override 35 | protected void configure() { 36 | bind(Example.class).to(ExampleImpl.class); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/main/resources/configuration.plist: -------------------------------------------------------------------------------- 1 | { 2 | de = { 3 | devsurf = { 4 | configuration = { 5 | message = "yeahhh out of the package :)"; 6 | } 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/src/main/resources/configuration.properties: -------------------------------------------------------------------------------- 1 | message=yeahh!! -------------------------------------------------------------------------------- /examples/src/main/resources/jndi.properties: -------------------------------------------------------------------------------- 1 | java.naming.factory.initial = de.devsurf.injection.guice.integrations.guicyfruit.jndi.GuicyInitialContextFactory 2 | guice.classpath.scanner = de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner 3 | guice.classpath.packages =de.devsurf.injection.guice.integrations.example.guicy.jndi;de.devsurf.injection.guice.integrations.guicyfruit -------------------------------------------------------------------------------- /integrations/commons.configurations/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | integrations 5 | de.devsurf.injection.guice 6 | 0.9.1-SNAPSHOT 7 | 8 | de.devsurf.injection.guice.integrations 9 | de.devsurf.injection.guice.integrations.commons.configurations 10 | 0.9.1-SNAPSHOT 11 | 12 | ${project.parent.parent.basedir} 13 | 14 | 15 | 16 | de.devsurf.injection.guice 17 | de.devsurf.injection.guice.core 18 | 0.9.1-SNAPSHOT 19 | jar 20 | compile 21 | 22 | 23 | commons-configuration 24 | commons-configuration 25 | 1.6 26 | compile 27 | 28 | 29 | de.devsurf.injection.guice.scanner 30 | de.devsurf.injection.guice.scanner.asm 31 | 0.9.1-SNAPSHOT 32 | jar 33 | test 34 | 35 | 36 | -------------------------------------------------------------------------------- /integrations/commons.configurations/src/test/java/de/devsurf/injection/guice/integrations/test/commons/configuration/AllTests.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.integrations.test.commons.configuration; 17 | 18 | import org.junit.runner.RunWith; 19 | import org.junit.runners.Suite; 20 | 21 | import de.devsurf.injection.guice.integrations.test.commons.configuration.classpath.ClasspathConfigTests; 22 | import de.devsurf.injection.guice.integrations.test.commons.configuration.file.FileConfigTests; 23 | import de.devsurf.injection.guice.integrations.test.commons.configuration.url.URLConfigTests; 24 | 25 | @RunWith(Suite.class) 26 | @Suite.SuiteClasses( { ClasspathConfigTests.class, FileConfigTests.class, URLConfigTests.class }) 27 | public class AllTests { 28 | } 29 | -------------------------------------------------------------------------------- /integrations/commons.configurations/src/test/resources/configuration.plist: -------------------------------------------------------------------------------- 1 | { 2 | de = { 3 | devsurf = { 4 | configuration = { 5 | message = "yeahhh out of the package :)"; 6 | } 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /integrations/enterprise/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | de.devsurf.injection.guice 5 | integrations 6 | 0.9.1-SNAPSHOT 7 | 8 | de.devsurf.injection.guice.integrations 9 | de.devsurf.injection.guice.integrations.enterprise 10 | 0.9.1-SNAPSHOT 11 | 12 | ${project.parent.parent.basedir} 13 | 14 | 15 | 16 | de.devsurf.injection.guice.scanner 17 | de.devsurf.injection.guice.scanner.asm 18 | 0.9.1-SNAPSHOT 19 | jar 20 | test 21 | 22 | 23 | com.google.inject.extensions 24 | guice-servlet 25 | 2.0 26 | jar 27 | compile 28 | 29 | 30 | javax 31 | javaee-api 32 | 6.0 33 | jar 34 | provided 35 | 36 | 37 | de.devsurf.injection.guice 38 | de.devsurf.injection.guice.aop 39 | 0.9.1-SNAPSHOT 40 | compile 41 | 42 | 43 | -------------------------------------------------------------------------------- /integrations/enterprise/src/main/java/de/devsurf/injection/guice/enterprise/Annotations.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.enterprise; 17 | 18 | import java.lang.annotation.Annotation; 19 | 20 | import javax.interceptor.Interceptor; 21 | 22 | public class Annotations extends de.devsurf.injection.guice.annotations.Annotations{ 23 | public static Interceptor createInterceptor(){ 24 | return new Interceptor() { 25 | @Override 26 | public Class annotationType() { 27 | return Interceptor.class; 28 | } 29 | }; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /integrations/enterprise/src/main/java/de/devsurf/injection/guice/enterprise/BeansXMLFeature.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * 18 | */ 19 | package de.devsurf.injection.guice.enterprise; 20 | 21 | import java.lang.annotation.Annotation; 22 | import java.util.Map; 23 | 24 | import javax.inject.Singleton; 25 | 26 | import de.devsurf.injection.guice.install.BindingStage; 27 | import de.devsurf.injection.guice.scanner.features.BindingScannerFeature; 28 | 29 | @Singleton 30 | public class BeansXMLFeature extends BindingScannerFeature { 31 | @Override 32 | public BindingStage accept(Class annotatedClass, Map annotations) { 33 | return BindingStage.IGNORE; 34 | } 35 | 36 | @Override 37 | public void process(final Class annotatedClass, 38 | final Map annotations) { 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /integrations/enterprise/src/main/java/de/devsurf/injection/guice/enterprise/model/Alternatives.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.enterprise.model; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | import javax.xml.bind.annotation.XmlAccessType; 22 | import javax.xml.bind.annotation.XmlAccessorType; 23 | import javax.xml.bind.annotation.XmlElement; 24 | 25 | 26 | @XmlAccessorType(XmlAccessType.FIELD) 27 | public class Alternatives { 28 | @XmlElement(name = "class", namespace = "http://java.sun.com/xml/ns/javaee") 29 | protected List classes; 30 | 31 | public List getClasses() { 32 | if (classes == null) { 33 | classes = new ArrayList(); 34 | } 35 | return this.classes; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /integrations/enterprise/src/main/java/de/devsurf/injection/guice/enterprise/model/Decorators.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.enterprise.model; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | import javax.xml.bind.annotation.XmlAccessType; 22 | import javax.xml.bind.annotation.XmlAccessorType; 23 | import javax.xml.bind.annotation.XmlElement; 24 | 25 | 26 | 27 | @XmlAccessorType(XmlAccessType.FIELD) 28 | public class Decorators { 29 | @XmlElement(name = "class", namespace = "http://java.sun.com/xml/ns/javaee") 30 | protected List classes; 31 | 32 | public List getClasses() { 33 | if (classes == null) { 34 | classes = new ArrayList(); 35 | } 36 | return this.classes; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /integrations/enterprise/src/main/java/de/devsurf/injection/guice/enterprise/model/Interceptors.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.enterprise.model; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | import javax.xml.bind.annotation.XmlAccessType; 22 | import javax.xml.bind.annotation.XmlAccessorType; 23 | import javax.xml.bind.annotation.XmlElement; 24 | 25 | 26 | @XmlAccessorType(XmlAccessType.FIELD) 27 | public class Interceptors { 28 | @XmlElement(name = "class", namespace = "http://java.sun.com/xml/ns/javaee") 29 | protected List classes; 30 | 31 | public List getClasses() { 32 | if (classes == null) { 33 | classes = new ArrayList(); 34 | } 35 | return this.classes; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /integrations/enterprise/src/main/java/javax/enterprise/inject/Alternative.java: -------------------------------------------------------------------------------- 1 | package javax.enterprise.inject; 2 | 3 | import static java.lang.annotation.ElementType.FIELD; 4 | import static java.lang.annotation.ElementType.METHOD; 5 | import static java.lang.annotation.ElementType.TYPE; 6 | 7 | import java.lang.annotation.Documented; 8 | import java.lang.annotation.Retention; 9 | import java.lang.annotation.RetentionPolicy; 10 | import java.lang.annotation.Target; 11 | 12 | @Target({TYPE, METHOD, FIELD}) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Documented 15 | public @interface Alternative 16 | { 17 | } -------------------------------------------------------------------------------- /integrations/enterprise/src/test/java/de/devsurf/injection/guice/integrations/tests/enterprise/AllTests.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.integrations.tests.enterprise; 17 | 18 | import org.junit.runner.RunWith; 19 | import org.junit.runners.Suite; 20 | 21 | @RunWith(Suite.class) 22 | @Suite.SuiteClasses( { EnterpriseTests.class }) 23 | public class AllTests { 24 | } 25 | -------------------------------------------------------------------------------- /integrations/enterprise/src/test/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | de.devsurf.injection.guice.integrations.tests.enterprise.EnterpriseTests$AlternativeImplementation 5 | 6 | 7 | -------------------------------------------------------------------------------- /integrations/enterprise/src/test/resources/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | de.devsurf.injection.guice.integrations.tests.enterprise.EnterpriseTests$AlternativeImplementation 5 | 6 | 7 | -------------------------------------------------------------------------------- /integrations/guicyfruit/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | de.devsurf.injection.guice 5 | integrations 6 | 0.9.1-SNAPSHOT 7 | 8 | de.devsurf.injection.guice.integrations 9 | de.devsurf.injection.guice.integrations.guicyfruit 10 | 0.9.1-SNAPSHOT 11 | 12 | ${project.parent.parent.basedir} 13 | 14 | 15 | 16 | org.guiceyfruit 17 | guiceyfruit-core 18 | 2.0 19 | 20 | 21 | org.guiceyfruit 22 | guice-all 23 | 24 | 25 | 26 | 27 | de.devsurf.injection.guice.scanner 28 | de.devsurf.injection.guice.scanner.asm 29 | 0.9.1-SNAPSHOT 30 | jar 31 | test 32 | 33 | 34 | 35 | 36 | guiceyfruit.release 37 | GuiceyFruit Release Repository 38 | http://guiceyfruit.googlecode.com/svn/repo/releases/ 39 | 40 | false 41 | 42 | 43 | true 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /integrations/guicyfruit/src/main/java/de/devsurf/injection/guice/integrations/guicyfruit/JSR250Module.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.integrations.guicyfruit; 17 | 18 | import javax.annotation.PostConstruct; 19 | import javax.annotation.PreDestroy; 20 | import javax.annotation.Resource; 21 | 22 | import de.devsurf.injection.guice.install.BindingStage; 23 | import org.guiceyfruit.jsr250.Jsr250Module; 24 | 25 | import de.devsurf.injection.guice.annotations.GuiceModule; 26 | 27 | /** 28 | * JSR250-Module provided by GuicyFruit, so {@link PostConstruct}, 29 | * {@link Resource} and {@link PreDestroy} can be used. 30 | * 31 | * @author Daniel Manzke 32 | * 33 | */ 34 | @GuiceModule(stage = BindingStage.BOOT) 35 | public class JSR250Module extends Jsr250Module { 36 | public JSR250Module() { 37 | super(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /integrations/guicyfruit/src/test/java/de/devsurf/injection/guice/integrations/test/guicyfruit/AllTests.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.integrations.test.guicyfruit; 17 | 18 | import org.junit.runner.RunWith; 19 | import org.junit.runners.Suite; 20 | 21 | import de.devsurf.injection.guice.integrations.test.guicyfruit.jndi.JNDIConstructionTests; 22 | import de.devsurf.injection.guice.integrations.test.guicyfruit.post.PostConstructionTests; 23 | 24 | @RunWith(Suite.class) 25 | @Suite.SuiteClasses( { PostConstructionTests.class, JNDIConstructionTests.class }) 26 | public class AllTests { 27 | } 28 | -------------------------------------------------------------------------------- /integrations/guicyfruit/src/test/resources/jndi.properties: -------------------------------------------------------------------------------- 1 | java.naming.factory.initial = de.devsurf.injection.guice.integrations.guicyfruit.jndi.GuicyInitialContextFactory 2 | guice.classpath.scanner = de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner 3 | guice.classpath.packages =de.devsurf.injection.guice.integrations.test.guicyfruit.jndi;de.devsurf.injection.guice.integrations.guicyfruit -------------------------------------------------------------------------------- /integrations/metro/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | de.devsurf.injection.guice 5 | integrations 6 | 0.9.1-SNAPSHOT 7 | 8 | de.devsurf.injection.guice.integrations 9 | de.devsurf.injection.guice.integrations.metro 10 | 0.9.1-SNAPSHOT 11 | 12 | ${project.parent.parent.basedir} 13 | 14 | 15 | 16 | de.devsurf.injection.guice.scanner 17 | de.devsurf.injection.guice.scanner.asm 18 | 0.9.1-SNAPSHOT 19 | jar 20 | test 21 | 22 | 23 | com.google.inject.extensions 24 | guice-servlet 25 | 2.0 26 | jar 27 | compile 28 | 29 | 30 | javax.servlet 31 | servlet-api 32 | 2.5 33 | jar 34 | provided 35 | 36 | 37 | com.sun.xml.ws 38 | jaxws-rt 39 | 2.1.4 40 | jar 41 | provided 42 | 43 | 44 | -------------------------------------------------------------------------------- /integrations/metro/src/main/java/de/devsurf/injection/guice/integrations/metro/GuiceManaged.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.integrations.metro; 17 | 18 | import static java.lang.annotation.ElementType.TYPE; 19 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 20 | 21 | import java.lang.annotation.Documented; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.Target; 24 | 25 | import javax.xml.ws.spi.WebServiceFeatureAnnotation; 26 | 27 | import com.sun.xml.ws.api.server.InstanceResolverAnnotation; 28 | 29 | @Retention(RUNTIME) 30 | @Target(TYPE) 31 | @Documented 32 | @WebServiceFeatureAnnotation(id = GuiceManagedFeature.ID, bean = GuiceManagedFeature.class) 33 | @InstanceResolverAnnotation(AutomaticGuiceManager.class) 34 | public @interface GuiceManaged { 35 | } 36 | -------------------------------------------------------------------------------- /integrations/metro/src/main/java/de/devsurf/injection/guice/integrations/metro/GuiceManagedFeature.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.integrations.metro; 17 | 18 | import javax.xml.ws.WebServiceFeature; 19 | 20 | import com.sun.xml.ws.api.FeatureConstructor; 21 | 22 | /** 23 | * @author Daniel Manzke 24 | */ 25 | public class GuiceManagedFeature extends WebServiceFeature { 26 | public static final String ID = "automatic.managed.feature"; 27 | 28 | @FeatureConstructor 29 | public GuiceManagedFeature() { 30 | this.enabled = true; 31 | } 32 | 33 | public String getID() { 34 | return ID; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /integrations/metro/src/main/java/de/devsurf/injection/guice/integrations/metro/InjectorProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.integrations.metro; 17 | 18 | import com.google.inject.Injector; 19 | import com.google.inject.Provider; 20 | 21 | public interface InjectorProvider extends Provider{ 22 | 23 | } 24 | -------------------------------------------------------------------------------- /integrations/metro/src/test/resources/jndi.properties: -------------------------------------------------------------------------------- 1 | java.naming.factory.initial = de.devsurf.injection.guice.integrations.guicyfruit.jndi.GuicyInitialContextFactory 2 | guice.classpath.scanner = de.devsurf.injection.guice.scanner.asm.ASMClasspathScanner 3 | guice.classpath.packages =de.devsurf.injection.guice.integrations.test.guicyfruit.jndi;de.devsurf.injection.guice.integrations.guicyfruit -------------------------------------------------------------------------------- /integrations/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | de.devsurf.injection.guice 5 | extensions 6 | 0.9.1-SNAPSHOT 7 | 8 | de.devsurf.injection.guice 9 | integrations 10 | 0.9.1-SNAPSHOT 11 | pom 12 | 13 | ${project.parent.basedir} 14 | 15 | 16 | guicyfruit 17 | commons.configurations 18 | enterprise 19 | metro 20 | 21 | 22 | 23 | de.devsurf.injection.guice 24 | de.devsurf.injection.guice.core 25 | 0.9.1-SNAPSHOT 26 | 27 | 28 | -------------------------------------------------------------------------------- /scanner/asm/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | de.devsurf.injection.guice 5 | scanner 6 | 0.9.1-SNAPSHOT 7 | 8 | de.devsurf.injection.guice.scanner 9 | de.devsurf.injection.guice.scanner.asm 10 | jar 11 | 12 | ${project.parent.parent.basedir} 13 | 14 | 15 | 16 | de.devsurf.injection.guice 17 | de.devsurf.injection.guice.core 18 | 0.9.1-SNAPSHOT 19 | 20 | 21 | asm 22 | asm 23 | 3.3 24 | jar 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /scanner/asm/src/test/java/de/devsurf/injection/guice/scanner/asm/tests/autobind/filter/dummy/DummyImplementation.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.asm.tests.autobind.filter.dummy; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.asm.tests.autobind.filter.PackageFilterTests.SecondTestInterface; 20 | import de.devsurf.injection.guice.scanner.asm.tests.autobind.filter.PackageFilterTests.TestInterface; 21 | 22 | @Bind 23 | public class DummyImplementation implements TestInterface, SecondTestInterface { 24 | public static final String TEST = "test"; 25 | public static final String EVENT = "event"; 26 | 27 | @Override 28 | public String sayHello() { 29 | return TEST; 30 | } 31 | 32 | @Override 33 | public String fireEvent() { 34 | return EVENT; 35 | } 36 | } -------------------------------------------------------------------------------- /scanner/asm/src/test/java/de/devsurf/injection/guice/scanner/asm/tests/autobind/provider/Container.java: -------------------------------------------------------------------------------- 1 | package de.devsurf.injection.guice.scanner.asm.tests.autobind.provider; 2 | 3 | import javax.inject.Inject; 4 | import javax.inject.Named; 5 | 6 | public class Container { 7 | @Inject @Named("mode") 8 | private Mode mode; 9 | 10 | public Mode get(){ 11 | return mode; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /scanner/asm/src/test/java/de/devsurf/injection/guice/scanner/asm/tests/autobind/provider/Mode.java: -------------------------------------------------------------------------------- 1 | package de.devsurf.injection.guice.scanner.asm.tests.autobind.provider; 2 | 3 | public enum Mode { 4 | ALL, 5 | UNKNOWN 6 | } 7 | -------------------------------------------------------------------------------- /scanner/asm/src/test/java/de/devsurf/injection/guice/scanner/asm/tests/autobind/startconfig/Container.java: -------------------------------------------------------------------------------- 1 | package de.devsurf.injection.guice.scanner.asm.tests.autobind.startconfig; 2 | 3 | import javax.inject.Inject; 4 | import javax.inject.Named; 5 | 6 | public class Container { 7 | @Inject @Named("mode") 8 | private Mode mode; 9 | 10 | public Mode get(){ 11 | return mode; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /scanner/asm/src/test/java/de/devsurf/injection/guice/scanner/asm/tests/autobind/startconfig/Mode.java: -------------------------------------------------------------------------------- 1 | package de.devsurf.injection.guice.scanner.asm.tests.autobind.startconfig; 2 | 3 | public enum Mode { 4 | ALL, 5 | UNKNOWN 6 | } 7 | -------------------------------------------------------------------------------- /scanner/asm/src/test/resources/conf/startup.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ALL 5 | 6 | -------------------------------------------------------------------------------- /scanner/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | extensions 5 | de.devsurf.injection.guice 6 | 0.9.1-SNAPSHOT 7 | 8 | de.devsurf.injection.guice 9 | scanner 10 | Guice Automatic Binding - Scanner implementations 11 | 0.9.1-SNAPSHOT 12 | pom 13 | 14 | ${project.parent.basedir} 15 | 16 | 17 | asm 18 | reflections 19 | sonatype 20 | 21 | 22 | 23 | de.devsurf.injection.guice 24 | de.devsurf.injection.guice.core 25 | 0.9.1-SNAPSHOT 26 | 27 | 28 | -------------------------------------------------------------------------------- /scanner/reflections/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | de.devsurf.injection.guice 5 | scanner 6 | 0.9.1-SNAPSHOT 7 | 8 | de.devsurf.injection.guice.scanner 9 | de.devsurf.injection.guice.scanner.reflections 10 | jar 11 | 12 | ${project.parent.parent.basedir} 13 | 14 | 15 | 16 | org.reflections 17 | reflections 18 | 0.9.5-RC2 19 | 20 | 21 | 22 | 23 | reflections-repo 24 | Reflections Maven2 Repository 25 | http://reflections.googlecode.com/svn/repo 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /scanner/reflections/src/test/java/de/devsurf/injection/guice/scanner/reflections/tests/AllTests.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.reflections.tests; 17 | 18 | import org.junit.runner.RunWith; 19 | import org.junit.runners.Suite; 20 | 21 | import de.devsurf.injection.guice.scanner.reflections.tests.autobind.AutobindTests; 22 | import de.devsurf.injection.guice.scanner.reflections.tests.autobind.bind.InterfaceAutobindTests; 23 | import de.devsurf.injection.guice.scanner.reflections.tests.autobind.filter.PackageFilterTests; 24 | import de.devsurf.injection.guice.scanner.reflections.tests.autobind.multiple.MultibindTests; 25 | import de.devsurf.injection.guice.scanner.reflections.tests.autobind.names.NamedAutobindTests; 26 | 27 | @RunWith(Suite.class) 28 | @Suite.SuiteClasses( { AutobindTests.class, InterfaceAutobindTests.class, NamedAutobindTests.class, 29 | MultibindTests.class, PackageFilterTests.class }) 30 | public class AllTests { 31 | } 32 | -------------------------------------------------------------------------------- /scanner/reflections/src/test/java/de/devsurf/injection/guice/scanner/reflections/tests/autobind/filter/dummy/DummyImplementation.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.reflections.tests.autobind.filter.dummy; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.reflections.tests.autobind.filter.PackageFilterTests.SecondTestInterface; 20 | import de.devsurf.injection.guice.scanner.reflections.tests.autobind.filter.PackageFilterTests.TestInterface; 21 | 22 | @Bind 23 | public class DummyImplementation implements TestInterface, SecondTestInterface { 24 | public static final String TEST = "test"; 25 | public static final String EVENT = "event"; 26 | 27 | @Override 28 | public String sayHello() { 29 | return TEST; 30 | } 31 | 32 | @Override 33 | public String fireEvent() { 34 | return EVENT; 35 | } 36 | } -------------------------------------------------------------------------------- /scanner/sonatype/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | de.devsurf.injection.guice 5 | scanner 6 | 0.9.1-SNAPSHOT 7 | 8 | de.devsurf.injection.guice.scanner 9 | de.devsurf.injection.guice.scanner.sonatype 10 | jar 11 | 12 | ${project.parent.parent.basedir} 13 | 14 | 15 | 16 | de.devsurf.injection.guice.scanner 17 | de.devsurf.injection.guice.scanner.asm 18 | 0.9.1-SNAPSHOT 19 | 20 | 21 | org.sonatype.spice.inject 22 | guice-bean 23 | 1.3.4 24 | pom 25 | 26 | 27 | org.sonatype.spice.inject 28 | guice-bean-inject 29 | 1.3.4 30 | 31 | 32 | org.sonatype.spice.inject 33 | guice-bean-containers 34 | 1.3.4 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /scanner/sonatype/src/test/java/de/devsurf/injection/guice/scanner/sonatype/tests/AllTests.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.sonatype.tests; 17 | 18 | import org.junit.runner.RunWith; 19 | import org.junit.runners.Suite; 20 | 21 | import de.devsurf.injection.guice.scanner.sonatype.tests.autobind.AutobindTests; 22 | import de.devsurf.injection.guice.scanner.sonatype.tests.autobind.bind.InterfaceAutobindTests; 23 | import de.devsurf.injection.guice.scanner.sonatype.tests.autobind.filter.PackageFilterTests; 24 | import de.devsurf.injection.guice.scanner.sonatype.tests.autobind.multiple.MultibindTests; 25 | import de.devsurf.injection.guice.scanner.sonatype.tests.autobind.names.NamedAutobindTests; 26 | 27 | @RunWith(Suite.class) 28 | @Suite.SuiteClasses( { AutobindTests.class, InterfaceAutobindTests.class, NamedAutobindTests.class, 29 | MultibindTests.class, PackageFilterTests.class }) 30 | public class AllTests { 31 | } 32 | -------------------------------------------------------------------------------- /scanner/sonatype/src/test/java/de/devsurf/injection/guice/scanner/sonatype/tests/autobind/filter/dummy/DummyImplementation.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2010 Daniel Manzke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.devsurf.injection.guice.scanner.sonatype.tests.autobind.filter.dummy; 17 | 18 | import de.devsurf.injection.guice.annotations.Bind; 19 | import de.devsurf.injection.guice.scanner.sonatype.tests.autobind.filter.PackageFilterTests.SecondTestInterface; 20 | import de.devsurf.injection.guice.scanner.sonatype.tests.autobind.filter.PackageFilterTests.TestInterface; 21 | 22 | @Bind 23 | public class DummyImplementation implements TestInterface, SecondTestInterface { 24 | public static final String TEST = "test"; 25 | public static final String EVENT = "event"; 26 | 27 | @Override 28 | public String sayHello() { 29 | return TEST; 30 | } 31 | 32 | @Override 33 | public String fireEvent() { 34 | return EVENT; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | de.devsurf.injection.guice 5 | extensions 6 | 0.9.1-SNAPSHOT 7 | 8 | de.devsurf.injection.guice 9 | de.devsurf.injection.guice.tests 10 | jar 11 | 12 | ${project.parent.basedir} 13 | 14 | 15 | 16 | de.devsurf.injection.guice.scanner 17 | de.devsurf.injection.guice.scanner.asm 18 | 0.9.1-SNAPSHOT 19 | jar 20 | test 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /tests/src/test/resources/conf/functions.properties: -------------------------------------------------------------------------------- 1 | function.1=read all files of this folder -------------------------------------------------------------------------------- /tests/src/test/resources/conf/messages.properties: -------------------------------------------------------------------------------- 1 | message.1=loaded by iterating through folder -------------------------------------------------------------------------------- /tests/src/test/resources/configuration.override.properties: -------------------------------------------------------------------------------- 1 | message=overriden yeahh!! -------------------------------------------------------------------------------- /tests/src/test/resources/configuration.properties: -------------------------------------------------------------------------------- 1 | message=yeahh!! --------------------------------------------------------------------------------