Class ClassInjector.UsingLookup.Dispatcher.ForJava9CapableVm

    • Constructor Detail

      • ForJava9CapableVm

        protected ForJava9CapableVm​(Method privateLookupIn,
                                    Method lookupClass,
                                    Method lookupModes,
                                    Method defineClass)
        Creates a new dispatcher for a Java 9 capable VM.
        Parameters:
        privateLookupIn - The java.lang.invoke.MethodHandles$#privateLookupIn method.
        lookupClass - The java.lang.invoke.MethodHandles$Lookup#lookupClass method.
        lookupModes - The java.lang.invoke.MethodHandles$Lookup#lookupModes method.
        defineClass - The java.lang.invoke.MethodHandles$Lookup#defineClass method.
    • Method Detail

      • lookupModes

        public int lookupModes​(Object lookup)
        Returns a lookup objects lookup types.
        Specified by:
        lookupModes in interface ClassInjector.UsingLookup.Dispatcher
        Parameters:
        lookup - The lookup instance.
        Returns:
        The modifiers indicating the instance's lookup modes.
      • resolve

        public Object resolve​(Object lookup,
                              Class<?> type)
        Resolves the supplied lookup instance's access scope for the supplied type.
        Specified by:
        resolve in interface ClassInjector.UsingLookup.Dispatcher
        Parameters:
        lookup - The lookup to use.
        type - The type to resolve the scope for.
        Returns:
        An appropriate lookup instance.
      • defineClass

        public Class<?> defineClass​(Object lookup,
                                    byte[] binaryRepresentation)
        Defines a class.
        Specified by:
        defineClass in interface ClassInjector.UsingLookup.Dispatcher
        Parameters:
        lookup - The java.lang.invoke.MethodHandles$Lookup instance to use.
        binaryRepresentation - The defined class's binary representation.
        Returns:
        The defined class.