-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize JSR250 lifecycle annotation detection
- Loading branch information
1 parent
17ad8b2
commit de8c0be
Showing
7 changed files
with
102 additions
and
129 deletions.
There are no files selected for viewing
33 changes: 0 additions & 33 deletions
33
...c/main/java/org/seedstack/seed/core/internal/lifecycle/ConstructionProvisionListener.java
This file was deleted.
Oops, something went wrong.
67 changes: 0 additions & 67 deletions
67
core/src/main/java/org/seedstack/seed/core/internal/lifecycle/DestructionMatcher.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
core/src/main/java/org/seedstack/seed/core/internal/lifecycle/SingletonScopingVisitor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org> | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package org.seedstack.seed.core.internal.lifecycle; | ||
|
||
import com.google.inject.Scope; | ||
import com.google.inject.Scopes; | ||
import com.google.inject.spi.BindingScopingVisitor; | ||
|
||
import javax.inject.Singleton; | ||
import java.lang.annotation.Annotation; | ||
|
||
final class SingletonScopingVisitor implements BindingScopingVisitor<Boolean> { | ||
static final SingletonScopingVisitor INSTANCE = new SingletonScopingVisitor(); | ||
|
||
private SingletonScopingVisitor() { | ||
} | ||
|
||
@Override | ||
public Boolean visitEagerSingleton() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public Boolean visitScope(Scope scope) { | ||
return scope == Scopes.SINGLETON; | ||
} | ||
|
||
@Override | ||
public Boolean visitScopeAnnotation(Class<? extends Annotation> scopeAnnotation) { | ||
return scopeAnnotation.isAssignableFrom(Singleton.class) || scopeAnnotation.isAssignableFrom( | ||
com.google.inject.Singleton.class); | ||
} | ||
|
||
@Override | ||
public Boolean visitNoScoping() { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters