Skip to content

Commit 264fa26

Browse files
committed
minor changes
1 parent 790928e commit 264fa26

5 files changed

Lines changed: 10 additions & 16 deletions

File tree

build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ dependencies {
2323
implementation 'com.zaxxer:HikariCP:5.1.0'
2424
implementation 'redis.clients:jedis:5.1.2'
2525
implementation 'net.staticstudios:static-utils:1.0.1'
26-
// implementation 'net.staticstudios:static-messaging:1.0.0'
27-
2826

2927
testImplementation(platform('org.junit:junit-bom:5.10.3'))
3028
testImplementation('org.junit.jupiter:junit-jupiter')

src/main/java/net/staticstudios/data/DataManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ public <T> T get(DataKey key) throws DataDoesNotExistException {
604604
return (T) value;
605605
}
606606

607-
public <T extends UniqueData> T get(Class<T> clazz, UUID id) throws DataDoesNotExistException {
607+
public <T extends UniqueData> T get(Class<T> clazz, UUID id) {
608608
Map<UUID, UniqueData> uniqueData = uniqueDataCache.get(clazz);
609609
if (uniqueData != null) {
610610
UniqueData data = uniqueData.get(id);
@@ -613,7 +613,7 @@ public <T extends UniqueData> T get(Class<T> clazz, UUID id) throws DataDoesNotE
613613
}
614614
}
615615

616-
throw new DataDoesNotExistException("UniqueData does not exist: " + id);
616+
return null;
617617
}
618618

619619
public void addUniqueData(UniqueData data) {

src/main/java/net/staticstudios/data/ValueSerializer.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
11
package net.staticstudios.data;
22

3-
import java.lang.reflect.ParameterizedType;
4-
53
public interface ValueSerializer<D, S> {
64
D deserialize(S serialized);
75

86
S serialize(D deserialized);
97

10-
@SuppressWarnings("unchecked")
11-
default Class<D> getDeserializedType() {
12-
return (Class<D>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
13-
}
8+
Class<D> getDeserializedType();
149

15-
@SuppressWarnings("unchecked")
16-
default Class<S> getSerializedType() {
17-
return (Class<S>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[1];
18-
}
10+
Class<S> getSerializedType();
1911

12+
@SuppressWarnings("unchecked")
2013
default D unsafeDeserialize(Object serialized) {
2114
return deserialize((S) serialized);
2215
}
2316

17+
@SuppressWarnings("unchecked")
2418
default S unsafeSerialize(Object deserialized) {
2519
return serialize((D) deserialized);
2620
}

src/main/java/net/staticstudios/data/data/UniqueData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ public UniqueData getRootHolder() {
5555
}
5656

5757
@Override
58-
public boolean equals(Object obj) {
58+
public final boolean equals(Object obj) {
5959
if (this == obj) return true;
6060
if (obj == null || getClass() != obj.getClass()) return false;
6161
UniqueData that = (UniqueData) obj;
6262
return Objects.equals(getId(), that.getId());
6363
}
6464

6565
@Override
66-
public int hashCode() {
66+
public final int hashCode() {
6767
UUID id = getId();
6868
return id != null ? id.hashCode() : 0;
6969
}

src/test/java/net/staticstudios/data/DataManagerTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ public class DataManagerTest extends DataTest {
99
//todo: test inheritance
1010
//todo: test value serializers
1111
//todo: test references
12+
13+
//todo: when inserting an FPV, if no explicit initial value was specified (ignore defaults), then if an entry already exists in the db/cache, do not change it. use the existing one.
1214
}

0 commit comments

Comments
 (0)