package org.warp.cowdb; import it.unimi.dsi.fastutil.longs.LongArrayList; import org.warp.jcwdb.ann.DBDataType; import java.io.IOException; import java.lang.reflect.Method; interface IObjectsIO { T loadEnhancedObject(long reference, Class objectType) throws IOException; T loadObject(long reference) throws IOException; LongArrayList loadReferencesList(long reference) throws IOException; boolean loadBoolean(long reference) throws IOException; byte loadByte(long reference) throws IOException; short loadShort(long reference) throws IOException; char loadChar(long reference) throws IOException; int loadInt(long reference) throws IOException; long loadLong(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; void setBoolean(long reference, boolean value) throws IOException; void setByte(long reference, byte value) throws IOException; void setShort(long reference, short value) throws IOException; void setChar(long reference, char value) throws IOException; void setInt(long reference, int value) throws IOException; void setLong(long reference, long 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; } default long newBoolean(boolean value) throws IOException { long reference = newNullObject(); setBoolean(reference, value); return reference; } default long newByte(byte value) throws IOException { long reference = newNullObject(); setByte(reference, value); return reference; } default long newShort(short value) throws IOException { long reference = newNullObject(); setShort(reference, value); return reference; } default long newChar(char value) throws IOException { long reference = newNullObject(); setChar(reference, value); return reference; } default long newInt(int value) throws IOException { long reference = newNullObject(); setInt(reference, value); return reference; } default long newLong(long value) throws IOException { long reference = newNullObject(); setLong(reference, value); return reference; } void loadProperty(EnhancedObject enhancedObject, int propertyId, Method propertyGetter, DBDataType propertyType, long propertyUID) throws IOException; }