Class ClassLoadingStrategy.ForJnaInjection

  • All Implemented Interfaces:
    ClassLoadingStrategy<java.lang.ClassLoader>
    Enclosing interface:
    ClassLoadingStrategy<T extends java.lang.ClassLoader>

    @Enhance
    public static class ClassLoadingStrategy.ForJnaInjection
    extends java.lang.Object
    implements ClassLoadingStrategy<java.lang.ClassLoader>
    A class loading strategy that injects a class using JNA via the JNI DefineClass method. This strategy can only be used if JNA is explicitly added as a dependency. Some JVM implementations might not support this strategy.
    • Field Detail

      • protectionDomain

        @ValueHandling(REVERSE_NULLABILITY)
        private final java.security.ProtectionDomain protectionDomain
        The protection domain to use or null if no protection domain is set.
    • Constructor Detail

      • ForJnaInjection

        public ForJnaInjection()
        Creates a new class loading strategy for JNA-based injection with a default protection domain.
      • ForJnaInjection

        public ForJnaInjection​(java.security.ProtectionDomain protectionDomain)
        Creates a new class loading strategy for JNA-based injection.
        Parameters:
        protectionDomain - The protection domain to use or null if no protection domain is set.
    • Method Detail

      • load

        public java.util.Map<TypeDescription,​java.lang.Class<?>> load​(java.lang.ClassLoader classLoader,
                                                                            java.util.Map<TypeDescription,​byte[]> types)
        Loads a given collection of classes given their binary representation.
        Specified by:
        load in interface ClassLoadingStrategy<java.lang.ClassLoader>
        Parameters:
        classLoader - The class loader to used for loading the classes.
        types - Byte array representations of the types to be loaded mapped by their descriptions, where an iteration order defines an order in which they are supposed to be loaded, if relevant.
        Returns:
        A collection of the loaded classes which will be initialized in the iteration order of the returned collection.