alef-backend-java 0.16.21

Java (Panama FFM) backend for alef
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
    private static <T> java.util.List<T> readJsonList(MemorySegment resultPtr, com.fasterxml.jackson.core.type.TypeReference<java.util.List<T>> typeRef) throws {{ class_name }}Exception {
        try {
            if (resultPtr.equals(MemorySegment.NULL)) {
                checkLastError();
                return java.util.List.of();
            }
            String json = resultPtr.reinterpret(Long.MAX_VALUE).getString(0);
            {{ free_handle }}.invoke(resultPtr);
            return MAPPER.readValue(json, typeRef);
        } catch (Throwable e) {
            throw new {{ class_name }}Exception("FFI call failed", e);
        }
    }