Skip to content

Commit 4955e42

Browse files
authored
Significantly overhauls Scopelet contract (#7)
Signed-off-by: Laird Nelson <[email protected]>
1 parent 4f51778 commit 4955e42

File tree

9 files changed

+254
-246
lines changed

9 files changed

+254
-246
lines changed

NOTES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Scopes
2+
3+
A Scope used as a scope and not used as a qualifier goes on the Any qualifier.
4+
5+
A Scope used as a qualifier goes directly on a Scopelet.
6+
7+
A Scope used as a "parent" scope goes on another Scope.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ changes, regardless of project version and without notice.**
1515

1616
# Requirements
1717

18-
microBean™ Scopelet requires a Java runtime of version 21 or higher.
18+
microBean™ Scopelet requires a Java runtime of version 16 or higher.
1919

2020
# Installation
2121

@@ -27,7 +27,7 @@ dependency:
2727
<groupId>org.microbean</groupId>
2828
<artifactId>microbean-scopelet</artifactId>
2929
<!-- Always check https://search.maven.org/artifact/org.microbean/microbean-scopelet for up-to-date available versions. -->
30-
<version>0.0.6</version>
30+
<version>0.0.7</version>
3131
</dependency>
3232
```
3333

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<java.util.logging.config.file>${project.basedir}/src/test/java/logging.properties</java.util.logging.config.file>
7474

7575
<!-- maven-compiler-plugin properties -->
76-
<maven.compiler.release>23</maven.compiler.release>
76+
<maven.compiler.release>16</maven.compiler.release>
7777
<maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
7878
<maven.compiler.showWarnings>true</maven.compiler.showWarnings>
7979

@@ -147,7 +147,7 @@
147147
<dependency>
148148
<groupId>org.microbean</groupId>
149149
<artifactId>microbean-bean</artifactId>
150-
<version>0.0.15</version>
150+
<version>0.0.16</version>
151151
</dependency>
152152

153153
<dependency>
@@ -159,7 +159,7 @@
159159
<dependency>
160160
<groupId>org.microbean</groupId>
161161
<artifactId>microbean-reference</artifactId>
162-
<version>0.0.1</version>
162+
<version>0.0.2</version>
163163
</dependency>
164164

165165
</dependencies>

src/main/java/org/microbean/scopelet/MapBackedScopelet.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,10 @@ public abstract class MapBackedScopelet<M extends MapBackedScopelet<M>> extends
4545
/**
4646
* Creates a new {@link MapBackedScopelet}.
4747
*
48-
* @param scopeId an {@link Attributes} identifying the scope this {@link MapBackedScopelet} serves; must not be
49-
* {@code null}
50-
*
51-
* @exception NullPointerException if {@code scopeId} is {@code null}
52-
*
53-
* @see Scopelet#Scopelet(Attributes)
48+
* @see Scopelet#Scopelet()
5449
*/
55-
protected MapBackedScopelet(final Attributes scopeId) {
56-
super(scopeId);
50+
protected MapBackedScopelet() {
51+
super();
5752
this.creationLocks = new ConcurrentHashMap<>();
5853
this.instances = new ConcurrentHashMap<>();
5954
}

src/main/java/org/microbean/scopelet/NoneScopelet.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,12 @@
1919
import java.lang.constant.DynamicConstantDesc;
2020
import java.lang.constant.MethodHandleDesc;
2121

22-
import java.util.List;
2322
import java.util.Objects;
2423
import java.util.Optional;
2524

2625
import org.microbean.bean.AutoCloseableRegistry;
27-
import org.microbean.bean.BeanTypeList;
2826
import org.microbean.bean.DisposableReference;
2927
import org.microbean.bean.Factory;
30-
import org.microbean.bean.Id;
3128
import org.microbean.bean.Request;
3229

3330
import org.microbean.construct.Domain;
@@ -56,21 +53,10 @@ public class NoneScopelet extends Scopelet<NoneScopelet> implements Constable {
5653
* @exception NullPointerException if {@code domain} is {@code null}
5754
*/
5855
public NoneScopelet(final Domain domain) {
59-
super(NONE_ID); // the scope we implement
56+
super();
6057
this.domain = Objects.requireNonNull(domain, "domain");
6158
}
6259

63-
@Override // Scopelet<NoneScopelet>
64-
public Id id() {
65-
return
66-
new Id(BeanTypeList.of(this.domain,
67-
List.of(this.domain.declaredType(NoneScopelet.class.getCanonicalName()),
68-
this.domain.declaredType(null,
69-
this.domain.typeElement(Scopelet.class.getCanonicalName()),
70-
this.domain.declaredType(NoneScopelet.class.getCanonicalName())))),
71-
List.of(NONE_ID, anyQualifier())); // qualifiers
72-
}
73-
7460
// All parameters are nullable.
7561
// Non-final to permit subclasses to, e.g., add logging.
7662
@Override // Scopelet<NoneScopelet>

0 commit comments

Comments
 (0)