Class AgentBuilder.RedefinitionStrategy.Collector

java.lang.Object
net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy.Collector
Direct Known Subclasses:
AgentBuilder.RedefinitionStrategy.Collector.ForRedefinition, AgentBuilder.RedefinitionStrategy.Collector.ForRetransformation
Enclosing class:
AgentBuilder.RedefinitionStrategy

protected abstract static class AgentBuilder.RedefinitionStrategy.Collector extends Object
A collector is responsible for collecting classes that are to be considered for modification.
  • Field Details

  • Constructor Details

  • Method Details

    • consider

      protected void consider(Class<?> type, boolean modifiable)
      Considers a loaded class for collection.
      Parameters:
      type - The loaded type being considered.
      modifiable - true if the considered type is considered modifiable.
    • doConsider

      private void doConsider(AgentBuilder.RawMatcher matcher, AgentBuilder.Listener listener, TypeDescription typeDescription, Class<?> type, @MaybeNull Class<?> classBeingRedefined, @MaybeNull JavaModule module, boolean modifiable)
      Does consider the retransformation or redefinition of a loaded type.
      Parameters:
      matcher - A type matcher to apply.
      listener - The listener to apply during the consideration.
      typeDescription - The type description of the type being considered.
      type - The loaded type being considered.
      classBeingRedefined - The loaded type being considered or null if it should be considered non-available.
      module - The type's Java module or null if the current VM does not support modules.
      modifiable - true if the considered type is considered modifiable.
    • apply

      protected int apply(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator, AgentBuilder.RedefinitionStrategy.Listener redefinitionListener, int batch)
      Applies all types that this collector collected.
      Parameters:
      instrumentation - The instrumentation instance to apply changes to.
      redefinitionBatchAllocator - The redefinition batch allocator to use.
      redefinitionListener - The redefinition listener to use.
      batch - The next batch's index.
      Returns:
      The next batch's index after this application.
    • doApply

      protected abstract void doApply(Instrumentation instrumentation, List<Class<?>> types) throws UnmodifiableClassException, ClassNotFoundException
      Applies this collector.
      Parameters:
      instrumentation - The instrumentation instance to apply the transformation for.
      types - The types of the current patch to transform.
      Throws:
      UnmodifiableClassException - If a class is not modifiable.
      ClassNotFoundException - If a class could not be found.