Class ClassFile

java.lang.Object
org.springframework.core.test.tools.ClassFile

public final class ClassFile extends Object
In memory representation of a Java class.
Since:
6.0
Author:
Stephane Nicoll
  • Method Details

    • getName

      public String getName()
      Return the fully qualified name of the class.
      Returns:
      the class name
    • getContent

      public byte[] getContent()
      Return the bytecode content.
      Returns:
      the class content
    • of

      public static ClassFile of(String name, byte[] content)
      Factory method to create a new ClassFile from the given content.
      Parameters:
      name - the fully qualified name of the class
      content - the bytecode of the class
      Returns:
      a ClassFile instance
    • of

      public static ClassFile of(String name, InputStreamSource inputStreamSource)
      Factory method to create a new ClassFile from the given InputStreamSource.
      Parameters:
      name - the fully qualified name of the class
      inputStreamSource - the bytecode of the class
      Returns:
      a ClassFile instance
    • toClassName

      public static String toClassName(String path)
      Return the name of a class based on its relative path.
      Parameters:
      path - the path of the class
      Returns:
      the class name