Class ModuleVersionPlugin

java.lang.Object
net.bytebuddy.build.ModuleVersionPlugin
All Implemented Interfaces:
Closeable, AutoCloseable, Plugin, Plugin.Factory, ElementMatcher<TypeDescription>

@Enhance public class ModuleVersionPlugin extends Object implements Plugin, Plugin.Factory
A plugin that includes a version number in the declared module-info class.
  • Field Details

  • Constructor Details

    • ModuleVersionPlugin

      public ModuleVersionPlugin(@MaybeNull String version)
      Creates a new module version plugin.
      Parameters:
      version - The version to include or null to not include a version.
  • Method Details

    • make

      public Plugin make()
      Returns a plugin that can be used for a transformation and which is subsequently closed.
      Specified by:
      make in interface Plugin.Factory
      Returns:
      The plugin to use for type transformations.
    • apply

      public DynamicType.Builder<?> apply(DynamicType.Builder<?> builder, TypeDescription typeDescription, ClassFileLocator classFileLocator)
      Applies this plugin.
      Specified by:
      apply in interface Plugin
      Parameters:
      builder - The builder to use as a basis for the applied transformation.
      typeDescription - The type being transformed.
      classFileLocator - A class file locator that can locate other types in the scope of the project.
      Returns:
      The supplied builder with additional transformations registered.
    • matches

      public boolean matches(@MaybeNull TypeDescription target)
      Matches a target against this element matcher.
      Specified by:
      matches in interface ElementMatcher<TypeDescription>
      Parameters:
      target - The instance to be matched or null.
      Returns:
      true if the given element is matched by this matcher or false otherwise.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable