Class ClassReloadingStrategy.Dispatcher.ForJava6CapableVm

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.reflect.Method addTransformer
      The Instrumentation#addTransformer method.
      private java.lang.reflect.Method isModifiableClass
      The Instrumentation#isModifiableClass method.
      private java.lang.reflect.Method isRetransformClassesSupported
      The Instrumentation#isRetransformClassesSupported method.
      private java.lang.reflect.Method retransformClasses
      The Instrumentation#retransformClasses method.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ForJava6CapableVm​(java.lang.reflect.Method isModifiableClass, java.lang.reflect.Method isRetransformClassesSupported, java.lang.reflect.Method addTransformer, java.lang.reflect.Method retransformClasses)
      Creates a dispatcher for a Java 6 compatible VM.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addTransformer​(java.lang.instrument.Instrumentation instrumentation, java.lang.instrument.ClassFileTransformer classFileTransformer, boolean canRetransform)
      Registers a transformer.
      boolean isModifiableClass​(java.lang.instrument.Instrumentation instrumentation, java.lang.Class<?> type)
      Invokes the Instrumentation#isModifiableClass method.
      boolean isRetransformClassesSupported​(java.lang.instrument.Instrumentation instrumentation)
      Invokes the Instrumentation#isRetransformClassesSupported method.
      void retransformClasses​(java.lang.instrument.Instrumentation instrumentation, java.lang.Class<?>[] type)
      Retransforms the supplied classes.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • isModifiableClass

        private final java.lang.reflect.Method isModifiableClass
        The Instrumentation#isModifiableClass method.
      • isRetransformClassesSupported

        private final java.lang.reflect.Method isRetransformClassesSupported
        The Instrumentation#isRetransformClassesSupported method.
      • addTransformer

        private final java.lang.reflect.Method addTransformer
        The Instrumentation#addTransformer method.
      • retransformClasses

        private final java.lang.reflect.Method retransformClasses
        The Instrumentation#retransformClasses method.
    • Constructor Detail

      • ForJava6CapableVm

        protected ForJava6CapableVm​(java.lang.reflect.Method isModifiableClass,
                                    java.lang.reflect.Method isRetransformClassesSupported,
                                    java.lang.reflect.Method addTransformer,
                                    java.lang.reflect.Method retransformClasses)
        Creates a dispatcher for a Java 6 compatible VM.
        Parameters:
        isModifiableClass - The Instrumentation#isModifiableClass method.
        isRetransformClassesSupported - The Instrumentation#isRetransformClassesSupported method.
        addTransformer - The Instrumentation#addTransformer method.
        retransformClasses - The Instrumentation#retransformClasses method.
    • Method Detail

      • isModifiableClass

        public boolean isModifiableClass​(java.lang.instrument.Instrumentation instrumentation,
                                         java.lang.Class<?> type)
        Invokes the Instrumentation#isModifiableClass method.
        Specified by:
        isModifiableClass in interface ClassReloadingStrategy.Dispatcher
        Parameters:
        instrumentation - The instrumentation instance to invoke the method on.
        type - The type to consider for modifiability.
        Returns:
        true if the supplied type can be modified.
      • isRetransformClassesSupported

        public boolean isRetransformClassesSupported​(java.lang.instrument.Instrumentation instrumentation)
        Invokes the Instrumentation#isRetransformClassesSupported method.
        Specified by:
        isRetransformClassesSupported in interface ClassReloadingStrategy.Dispatcher
        Parameters:
        instrumentation - The instrumentation instance to invoke the method on.
        Returns:
        true if the supplied instrumentation instance supports retransformation.
      • addTransformer

        public void addTransformer​(java.lang.instrument.Instrumentation instrumentation,
                                   java.lang.instrument.ClassFileTransformer classFileTransformer,
                                   boolean canRetransform)
        Registers a transformer.
        Specified by:
        addTransformer in interface ClassReloadingStrategy.Dispatcher
        Parameters:
        instrumentation - The instrumentation instance to invoke the method on.
        classFileTransformer - The class file transformer to register.
        canRetransform - true if the class file transformer should be invoked upon a retransformation.
      • retransformClasses

        public void retransformClasses​(java.lang.instrument.Instrumentation instrumentation,
                                       java.lang.Class<?>[] type)
                                throws java.lang.instrument.UnmodifiableClassException
        Retransforms the supplied classes.
        Specified by:
        retransformClasses in interface ClassReloadingStrategy.Dispatcher
        Parameters:
        instrumentation - The instrumentation instance to invoke the method on.
        type - The types to retransform.
        Throws:
        java.lang.instrument.UnmodifiableClassException - If any of the supplied types are unmodifiable.