package it.cavallium.strangedb.java.database; import it.cavallium.strangedb.java.objects.EnhancedObject; import it.cavallium.strangedb.java.annotations.DbDataType; import it.cavallium.strangedb.java.objects.EnhancedObjectIndices; import it.unimi.dsi.fastutil.longs.LongArrayList; import it.unimi.dsi.fastutil.longs.LongList; import java.io.IOException; import java.lang.reflect.Method; public interface IObjectsIO { @SuppressWarnings("unchecked") T loadEnhancedObject(long reference) throws IOException; EnhancedObjectIndices loadEnhancedObjectUids(long reference) throws IOException; T loadObject(long reference) throws IOException; LongArrayList loadReferencesList(long reference) throws IOException; void setEnhancedObject(long reference, T value) throws IOException; void setObject(long reference, T value) throws IOException; void setReferencesList(long reference, LongArrayList value) throws IOException; long newNullObject() throws IOException; default long newEnhancedObject(T value) throws IOException { long reference = newNullObject(); if (value != null) { setEnhancedObject(reference, value); } return reference; } default 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; } void loadProperty(EnhancedObject enhancedObject, int propertyId, DbDataType propertyType, long propertyUID) throws IOException; void registerClass(Class type, int id); IDataInitializer getDataInitializer(); LongList loadPrimitiveData(long id) throws IOException; }