Skip to content

FromNativeContext using java.lang.reflect.Type instead of java.lang.Class #310

@marco2357

Description

@marco2357

Dummy example:

class Pointer<T> implements NativeMapped {
    public Object fromNative(Object nativeValue, FromNativeContext context) {
       // context.getTargetType() -> Pointer.class
    }
}

Sometimes it would be useful to know the full generic information. E.g. whether a Pointer<Integer>, a Pointer<Double> or a Pointer<Pointer<Pointer<Short>>> needs to be created.

This would be easy to implement; in the Native class, just give method.getGenericReturnType() to registerMethod() instead of method.getReturnType(), adapt fromNative() to take a Type and change the C code.
Though this would change the API and requires Java 1.5. So maybe instead of changing the API an addition would be better.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions