Skip to content

Commit b5f34a2

Browse files
committed
remove webJarVersion and hide the constructor to override the cache imp
1 parent 9959870 commit b5f34a2

File tree

4 files changed

+3
-23
lines changed

4 files changed

+3
-23
lines changed

README.md

-9
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,3 @@ WebJarVersionLocator webJarVersionLocator = new WebJarVersionLocator();
3131
webJarVersionLocator.version("bootstrap"); // cache miss
3232
webJarVersionLocator.version("bootstrap"); // cache hit, avoiding looking up metadata in the classpath
3333
```
34-
35-
The default cache uses a `ConcurrentHashMap` but you can provide a custom cache implementation:
36-
```
37-
class WebJarCacheMine implements WebJarCache {
38-
...
39-
}
40-
41-
WebJarVersionLocator webJarVersionLocator = new WebJarVersionLocator(new WebJarCacheMine());
42-
```

src/main/java/org/webjars/WebJarCache.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Cache keys and values are Strings because that is all that is needed.
1313
*/
1414
@NullMarked
15-
public interface WebJarCache {
15+
interface WebJarCache {
1616

1717
Optional<String> computeIfAbsent(String key, Function<String, Optional<String>> function);
1818

src/main/java/org/webjars/WebJarCacheDefault.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
@NullMarked
11-
public class WebJarCacheDefault implements WebJarCache {
11+
class WebJarCacheDefault implements WebJarCache {
1212

1313
final ConcurrentMap<String, Optional<String>> cache;
1414

src/main/java/org/webjars/WebJarVersionLocator.java

+1-12
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public WebJarVersionLocator() {
3434
this.cache = new WebJarCacheDefault(new ConcurrentHashMap<>());
3535
}
3636

37-
public WebJarVersionLocator(WebJarCache cache) {
37+
WebJarVersionLocator(WebJarCache cache) {
3838
this.cache = cache;
3939
}
4040

@@ -77,17 +77,6 @@ public String path(final String webJarName, final String exactPath) {
7777
return null;
7878
}
7979

80-
/**
81-
* @param webJarName The name of the WebJar, i.e. bootstrap
82-
* @return The version of the WebJar, i.e 3.1.1
83-
* @deprecated Use {@link #version(String)} instead
84-
*/
85-
@Deprecated
86-
@Nullable
87-
public String webJarVersion(final String webJarName) {
88-
return version(webJarName);
89-
}
90-
9180
/**
9281
* @param webJarName The name of the WebJar, i.e. bootstrap
9382
* @return The version of the WebJar, i.e 3.1.1

0 commit comments

Comments
 (0)