Class FFITypeFactory


  • public class FFITypeFactory
    extends Object
    • Constructor Detail

      • FFITypeFactory

        public FFITypeFactory()
    • Method Detail

      • loadClassLoader

        public static void loadClassLoader​(ClassLoader classLoader)
      • unloadClassLoader

        public static void unloadClassLoader​(ClassLoader classLoader)
      • getFFITypeName

        public static String getFFITypeName​(Type ffiType,
                                            boolean useDefaultMapping)
      • getFactory

        public static <T> T getFactory​(String ffiTypeName)
      • getFactory

        public static <T> T getFactory​(Class<?> ffiType)
        Get the factory from the FFIType. The FFIType must not have type parameters, which means it cannot be annotated with CXXTemplate
        Type Parameters:
        T -
        Parameters:
        ffiType -
        Returns:
      • getFactory

        public static <T> T getFactory​(Class<T> factoryType,
                                       Class<?> ffiType)
      • getFactory

        public static <T> T getFactory​(Class<?> ffiType,
                                       String ffiTypeName)
      • getLibrary

        public static <T> T getLibrary​(Class<T> libraryInterface,
                                       String ffiLibraryName)
        Get the FFILibrary with the given library interface and ffi name
        Type Parameters:
        T -
        Parameters:
        libraryInterface -
        ffiLibraryName -
        Returns:
      • getLibrary

        public static <T> T getLibrary​(Class<T> libraryInterface)
      • findNativeLibrary

        public static String findNativeLibrary​(Class<?> clazz,
                                               String libraryName)
      • newByteString

        public static com.alibaba.fastffi.FFIByteString newByteString()
      • getFFIByteStringFactory

        public static com.alibaba.fastffi.FFIByteString.Factory getFFIByteStringFactory()
      • newFFIVector

        public static <E> com.alibaba.fastffi.FFIVector<E> newFFIVector​(Type elementType)
        As slow as reflection
        Type Parameters:
        E -
        Parameters:
        elementType -
        Returns:
      • getFFIVectorFactory

        public static <T extends com.alibaba.fastffi.FFIVector.Factory> T getFFIVectorFactory​(Type elementType)
        accept primitive types, boxed primitive types, and
        Type Parameters:
        T -
        Parameters:
        elementType -
        Returns: