56 lines
1.6 KiB
Java
56 lines
1.6 KiB
Java
package org.warp.cowdb;
|
|
|
|
import org.warp.jcwdb.ann.DBDataType;
|
|
import org.warp.jcwdb.ann.DBPrimitiveType;
|
|
|
|
import java.io.IOException;
|
|
import java.util.function.Supplier;
|
|
|
|
public interface EnhancedObjectUpgrader {
|
|
<T> T getPrimitiveField(int id, DBPrimitiveType integer) throws IOException;
|
|
|
|
default int getPrimitiveBoolean(int id) throws IOException {
|
|
return getPrimitiveField(id, DBPrimitiveType.BOOLEAN);
|
|
}
|
|
|
|
default int getPrimitiveByte(int id) throws IOException {
|
|
return getPrimitiveField(id, DBPrimitiveType.BYTE);
|
|
}
|
|
|
|
default int getPrimitiveShort(int id) throws IOException {
|
|
return getPrimitiveField(id, DBPrimitiveType.SHORT);
|
|
}
|
|
|
|
default int getPrimitiveChar(int id) throws IOException {
|
|
return getPrimitiveField(id, DBPrimitiveType.CHAR);
|
|
}
|
|
|
|
default int getPrimitiveInt(int id) throws IOException {
|
|
return getPrimitiveField(id, DBPrimitiveType.INTEGER);
|
|
}
|
|
|
|
default long getPrimitiveLong(int id) throws IOException {
|
|
return getPrimitiveField(id, DBPrimitiveType.LONG);
|
|
}
|
|
|
|
default float getPrimitiveFloat(int id) throws IOException {
|
|
return getPrimitiveField(id, DBPrimitiveType.FLOAT);
|
|
}
|
|
|
|
default double getPrimitiveDouble(int id) throws IOException {
|
|
return getPrimitiveField(id, DBPrimitiveType.DOUBLE);
|
|
}
|
|
|
|
Object getField(int id, DBDataType type, Supplier<Class<?>> enhancedClassType) throws IOException;
|
|
|
|
default Object getField(int id, DBDataType type) throws IOException {
|
|
return getField(id, type, null);
|
|
}
|
|
|
|
Object getMethod(int id, DBDataType type, Supplier<Class<?>> enhancedClassType) throws IOException;
|
|
|
|
default Object getMethod(int id, DBDataType type) throws IOException {
|
|
return getField(id, type, null);
|
|
}
|
|
}
|