Skip to content

Commit cada4e8

Browse files
authored
Merge pull request #50 from JavaSaBr/extemd-api-v5
Extemd API v5
2 parents 925d9e2 + 8e249bd commit cada4e8

32 files changed

+1435
-139
lines changed

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repositories {
1414
}
1515
1616
ext {
17-
rlibVersion = "10.0.alpha5"
17+
rlibVersion = "10.0.alpha6"
1818
}
1919
2020
dependencies {
@@ -39,6 +39,7 @@ dependencies {
3939
### Fake SMTP Server
4040

4141
```java
42+
4243
var container = new FakeSMTPTestContainer()
4344
.withSmtpPassword("pwd")
4445
.withSmtpUser("test_user");
@@ -92,19 +93,15 @@ LoggerLevel.DEBUG.setEnabled(true);
9293

9394
logger.debug("Simple message");
9495
logger.debug(5, (val) -> "Lazy message with 5: " + val);
96+
logger.debug(5, "Lazy message with 5:%d"::formated);
9597
logger.debug(5, 10D, (val1, val2) -> "Lazy message with 5: " + val1 + " and 10: " + val2);
96-
logger.debug("", "Message with a string owner.");
97-
logger.debug("", 5, (val) -> "Lazy message with 5: " + val);
98-
logger.debug("", 5, 10D, (val1, val2) -> "Lazy message with 5: " + val1 + " and 10: " + val2);
98+
logger.debug(5, 10D, "Lazy message with 5:%d and 10:%d"::formatted);
9999

100100
// global disable debug level
101101
LoggerLevel.DEBUG.setEnabled(false);
102102

103103
// local enable debug level only for this logger instance
104104
logger.setEnabled(LoggerLevel.DEBUG, true);
105-
106-
// show debug message
107-
logger.debug("Showed");
108105
```
109106

110107
### Mail Sender
@@ -132,10 +129,9 @@ var javaxConfig = JavaxMailSender.JavaxMailSenderConfig
132129
var sender = new JavaxMailSender(config, javaxConfig);
133130

134131
sender.send("[email protected]","Test Subject","Content");
135-
136132
sender
137133
.sendAsync("[email protected]","Test Subject","Content")
138-
.thenAccept(aVoid ->System.out.println("done!"));
134+
.thenAccept(aVoid -> System.out.println("done!"));
139135
```
140136

141137
### Network API

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
rootProject.version = "10.0.alpha5"
1+
rootProject.version = "10.0.alpha6"
22
group = 'javasabr.rlib'
33

44
allprojects {

buildSrc/src/main/groovy/configure-java.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ dependencies {
5757
testImplementation libs.mockito.junit.jupiter
5858
testImplementation libs.junit.api
5959
testImplementation libs.junit.jupiter.params
60+
testImplementation libs.assertj.core
6061

6162
testCompileOnly libs.lombok
6263
testCompileOnly libs.jspecify

gradle/libs.versions.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ angus-mail = "2.0.4"
1010
# https://mvnrepository.com/artifact/org.testcontainers/testcontainers
1111
testcontainers = "1.21.3"
1212
# https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine
13-
junit-jupiter = "5.13.4"
13+
junit-jupiter = "6.0.1"
1414
# https://mvnrepository.com/artifact/org.projectlombok/lombok
1515
lombok = "1.18.38"
1616
# https://mvnrepository.com/artifact/org.jspecify/jspecify
1717
jspecify = "1.0.0"
18-
# https://mvnrepository.com/artifact/org.junit.platform/junit-platform-launcher
19-
junit-platform-launcher = "1.13.4"
2018
# https://mvnrepository.com/artifact/org.mockito/mockito-core
2119
mockito = "5.20.0"
20+
# https://mvnrepository.com/artifact/org.assertj/assertj-core
21+
assertj-core = "4.0.0-M1"
2222

2323
[libraries]
2424
project-reactor-core = { module = "io.projectreactor:reactor-core", version.ref = "project-reactor" }
@@ -27,7 +27,7 @@ lombok = { module = "org.projectlombok:lombok", version.ref = "lombok" }
2727
junit-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit-jupiter" }
2828
junit-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit-jupiter" }
2929
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit-jupiter" }
30-
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junit-platform-launcher" }
30+
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junit-jupiter" }
3131
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
3232
slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" }
3333
slf4j-ext = { module = "org.slf4j:slf4j-ext", version.ref = "slf4j" }
@@ -36,6 +36,7 @@ angus-mail = { module = "org.eclipse.angus:angus-mail", version.ref = "angus-mai
3636
testcontainers = { module = "org.testcontainers:testcontainers", version.ref = "testcontainers" }
3737
mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" }
3838
mockito-junit-jupiter = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockito" }
39+
assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj-core" }
3940

4041
[bundles]
4142
mail = ["jakarta-mail-api", "angus-mail"]

rlib-collections/src/main/java/javasabr/rlib/collections/array/Array.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import java.util.Iterator;
66
import java.util.List;
77
import java.util.Optional;
8-
import java.util.RandomAccess;
98
import java.util.function.Function;
109
import java.util.stream.Stream;
1110
import javasabr.rlib.collections.array.impl.DefaultArrayIterator;
@@ -16,7 +15,7 @@
1615
/**
1716
* @author JavaSaBr
1817
*/
19-
public interface Array<E> extends Iterable<E>, Serializable, Cloneable, RandomAccess {
18+
public interface Array<E> extends Iterable<E>, Serializable, Cloneable {
2019

2120
static <E> Array<E> empty(Class<? super E> type) {
2221
return new ImmutableArray<>(ClassUtils.unsafeCast(type));

rlib-collections/src/main/java/javasabr/rlib/collections/dictionary/Dictionary.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public interface Dictionary<K, V> extends Iterable<V> {
2424

2525
Optional<V> getOptional(K key);
2626

27-
@Nullable
2827
V getOrDefault(K key, V def);
2928

3029
<C extends Collection<K>> C keys(C container);

rlib-collections/src/main/java/javasabr/rlib/collections/dictionary/IntToRefDictionary.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,24 @@
1010

1111
public interface IntToRefDictionary<V> extends Dictionary<Integer, V> {
1212

13-
static <V> IntToRefEntry<V> entry(int key, @Nullable V value) {
13+
static <V> IntToRefEntry<V> entry(int key, V value) {
1414
return new SimpleIntToRefEntry<>(key, value);
1515
}
1616

1717
static <V> IntToRefDictionary<V> empty() {
1818
return ImmutableHashBasedIntToRefDictionary.empty();
1919
}
2020

21-
static <K, V> IntToRefDictionary<V> of(int key, @Nullable V value) {
21+
static <V> IntToRefDictionary<V> of(int key, V value) {
2222
return ofEntries(entry(key, value));
2323
}
2424

25-
static <K, V> IntToRefDictionary<V> of(int k1, @Nullable V v1, int k2, @Nullable V v2) {
25+
static <V> IntToRefDictionary<V> of(int k1, V v1, int k2, V v2) {
2626
return ofEntries(entry(k1, v1), entry(k2, v2));
2727
}
2828

2929
@SafeVarargs
30-
static <K, V> IntToRefDictionary<V> ofEntries(IntToRefEntry<V>... entries) {
30+
static <V> IntToRefDictionary<V> ofEntries(IntToRefEntry<V>... entries) {
3131
MutableIntToRefDictionary<V> mutable = DictionaryFactory.mutableIntToRefDictionary();
3232
for (var entry : entries) {
3333
mutable.put(entry.key(), entry.value());
@@ -42,7 +42,6 @@ static <K, V> IntToRefDictionary<V> ofEntries(IntToRefEntry<V>... entries) {
4242

4343
Optional<V> getOptional(int key);
4444

45-
@Nullable
4645
V getOrDefault(int key, V def);
4746

4847
MutableIntArray keys(MutableIntArray container);

rlib-collections/src/main/java/javasabr/rlib/collections/dictionary/LongToRefDictionary.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,24 @@
1010

1111
public interface LongToRefDictionary<V> extends Dictionary<Long, V> {
1212

13-
static <V> LongToRefEntry<V> entry(long key, @Nullable V value) {
13+
static <V> LongToRefEntry<V> entry(long key, V value) {
1414
return new SimpleLongToRefEntry<>(key, value);
1515
}
1616

17-
static <K, V> LongToRefDictionary<V> empty() {
17+
static <V> LongToRefDictionary<V> empty() {
1818
return ImmutableHashBasedLongToRefDictionary.empty();
1919
}
2020

21-
static <K, V> LongToRefDictionary<V> of(long key, @Nullable V value) {
21+
static <V> LongToRefDictionary<V> of(long key, V value) {
2222
return ofEntries(entry(key, value));
2323
}
2424

25-
static <K, V> LongToRefDictionary<V> of(long k1, @Nullable V v1, long k2, @Nullable V v2) {
25+
static <V> LongToRefDictionary<V> of(long k1, V v1, long k2, V v2) {
2626
return ofEntries(entry(k1, v1), entry(k2, v2));
2727
}
2828

2929
@SafeVarargs
30-
static <K, V> LongToRefDictionary<V> ofEntries(LongToRefEntry<V>... entries) {
30+
static <V> LongToRefDictionary<V> ofEntries(LongToRefEntry<V>... entries) {
3131
MutableLongToRefDictionary<V> mutable = DictionaryFactory.mutableLongToRefDictionary();
3232
for (var entry : entries) {
3333
mutable.put(entry.key(), entry.value());
@@ -42,7 +42,6 @@ static <K, V> LongToRefDictionary<V> ofEntries(LongToRefEntry<V>... entries) {
4242

4343
Optional<V> getOptional(long key);
4444

45-
@Nullable
4645
V getOrDefault(long key, V def);
4746

4847
MutableLongArray keys(MutableLongArray container);

rlib-collections/src/main/java/javasabr/rlib/collections/dictionary/MutableIntToRefDictionary.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,17 @@ static <V> MutableIntToRefDictionary<V> ofTypes(Class<V> valueType) {
1313
return new DefaultMutableHashBasedIntToRefDictionary<>();
1414
}
1515

16-
@Nullable
1716
V getOrCompute(int key, Supplier<V> factory);
1817

19-
@Nullable
2018
V getOrCompute(int key, IntFunction<V> factory);
2119

22-
@Nullable
2320
<T> V getOrCompute(int key, T arg1, Function<T, V> factory);
2421

2522
/**
2623
* @return the previous value for the key or null.
2724
*/
2825
@Nullable
29-
V put(int key, @Nullable V value);
26+
V put(int key, V value);
3027

3128
void putAll(IntToRefDictionary<? extends V> dictionary);
3229

@@ -35,7 +32,7 @@ static <V> MutableIntToRefDictionary<V> ofTypes(Class<V> valueType) {
3532
/**
3633
* @return the optional value of the previous value for the key.
3734
*/
38-
Optional<V> putOptional(int key, @Nullable V value);
35+
Optional<V> putOptional(int key, V value);
3936

4037
/**
4138
* @return the previous value for the key or null.
@@ -48,5 +45,7 @@ static <V> MutableIntToRefDictionary<V> ofTypes(Class<V> valueType) {
4845
*/
4946
Optional<V> removeOptional(int key);
5047

48+
void clear();
49+
5150
IntToRefDictionary<V> toReadOnly();
5251
}

rlib-collections/src/main/java/javasabr/rlib/collections/dictionary/MutableLongToRefDictionary.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,17 @@ static <V> MutableLongToRefDictionary<V> ofTypes(Class<V> valueType) {
1313
return new DefaultMutableHashBasedLongToRefDictionary<>();
1414
}
1515

16-
@Nullable
1716
V getOrCompute(long key, Supplier<V> factory);
1817

19-
@Nullable
2018
V getOrCompute(long key, LongFunction<V> factory);
2119

22-
@Nullable
2320
<T> V getOrCompute(long key, T arg1, Function<T, V> factory);
2421

2522
/**
2623
* @return the previous value for the key or null.
2724
*/
2825
@Nullable
29-
V put(long key, @Nullable V value);
26+
V put(long key, V value);
3027

3128
void putAll(LongToRefDictionary<? extends V> dictionary);
3229

@@ -35,7 +32,7 @@ static <V> MutableLongToRefDictionary<V> ofTypes(Class<V> valueType) {
3532
/**
3633
* @return the optional value of the previous value for the key.
3734
*/
38-
Optional<V> putOptional(long key, @Nullable V value);
35+
Optional<V> putOptional(long key, V value);
3936

4037
/**
4138
* @return the previous value for the key or null.
@@ -48,5 +45,7 @@ static <V> MutableLongToRefDictionary<V> ofTypes(Class<V> valueType) {
4845
*/
4946
Optional<V> removeOptional(long key);
5047

48+
void clear();
49+
5150
LongToRefDictionary<V> toReadOnly();
5251
}

0 commit comments

Comments
 (0)