├── .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 extends Object>[] 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 super Class>> 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 super Method> 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 extends Annotation> 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 extends Annotation> 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 extends Annotation> 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 extends Annotation> 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 extends Annotation> scoped, Class extends Provider> 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 extends Annotation> 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