strangedb/src/main/java/it/cavallium/strangedb/java/database/IObjectsIO.java

69 lines
2.1 KiB
Java
Raw Normal View History

2019-03-07 16:20:34 +01:00
package it.cavallium.strangedb.java.database;
2019-03-07 16:20:34 +01:00
import it.cavallium.strangedb.java.objects.EnhancedObject;
import it.cavallium.strangedb.java.annotations.DbDataType;
2019-04-18 16:08:22 +02:00
import it.cavallium.strangedb.java.objects.EnhancedObjectIndices;
import it.unimi.dsi.fastutil.longs.LongArrayList;
2019-03-06 17:25:56 +01:00
import it.unimi.dsi.fastutil.longs.LongList;
import java.io.IOException;
import java.lang.reflect.Method;
2019-02-01 00:04:51 +01:00
public interface IObjectsIO {
2019-04-18 16:08:22 +02:00
@SuppressWarnings("unchecked")
<T extends EnhancedObject> T loadEnhancedObject(long reference) throws IOException;
2019-04-20 03:46:59 +02:00
@SuppressWarnings("unchecked")
<T extends EnhancedObject> T loadEnhancedObject(long reference, Class<?> forcedType) throws IOException;
2019-04-18 16:08:22 +02:00
EnhancedObjectIndices loadEnhancedObjectUids(long reference) throws IOException;
<T> T loadObject(long reference) throws IOException;
LongArrayList loadReferencesList(long reference) throws IOException;
<T extends EnhancedObject> void setEnhancedObject(long reference, T value) throws IOException;
<T> void setObject(long reference, T value) throws IOException;
void setReferencesList(long reference, LongArrayList value) throws IOException;
long newNullObject() throws IOException;
default <T extends EnhancedObject> long newEnhancedObject(T value) throws IOException {
long reference = newNullObject();
if (value != null) {
setEnhancedObject(reference, value);
}
return reference;
}
default <T> long newObject(T value) throws IOException {
long reference = newNullObject();
if (value != null) {
setObject(reference, value);
}
return reference;
}
default long newReferencesList(LongArrayList value) throws IOException {
long reference = newNullObject();
if (value != null) {
setReferencesList(reference, value);
}
return reference;
}
2019-04-18 16:08:22 +02:00
void loadProperty(EnhancedObject enhancedObject, int propertyId, DbDataType propertyType, long propertyUID) throws IOException;
2019-02-01 00:04:51 +01:00
void registerClass(Class<?> type, int id);
2019-03-02 17:47:24 +01:00
IDataInitializer getDataInitializer();
2019-03-06 17:25:56 +01:00
2019-04-22 00:10:21 +02:00
Long loadReferencesListFirstElement(long reference) throws IOException;
Long loadReferencesListLastElement(long reference) throws IOException;
2019-03-06 17:25:56 +01:00
LongList loadPrimitiveData(long id) throws IOException;
}