Class Compiled
java.lang.Object
org.springframework.aot.test.generate.compile.Compiled
Fully compiled results provided from a
TestCompiler
.- Since:
- 6.0
- Author:
- Phillip Webb
-
Method Summary
Modifier and TypeMethodDescriptionReturn all compiled classes.Return the classloader containing the compiled content and access to the resources.<T> T
getInstance
(Class<T> type) Return a new instance of a compiled class of the given type.<T> T
getInstance
(Class<T> type, String className) Return an instance of a compiled class identified by its class name.Return the single resource file that was used when compiled.Return all resource files that were compiled.Return the single source file that was compiled.getSourceFile
(String pattern) Return the single matching source file that was compiled.getSourceFileFromPackage
(String packageName) Return the single source file that was compiled in the given package.Return all source files that were compiled.
-
Method Details
-
getClassLoader
Return the classloader containing the compiled content and access to the resources.- Returns:
- the classLoader
-
getSourceFile
Return the single source file that was compiled.- Returns:
- the single source file
- Throws:
IllegalStateException
- if the compiler wasn't passed exactly one file
-
getSourceFile
Return the single matching source file that was compiled.- Parameters:
pattern
- the pattern used to find the file- Returns:
- the single source file
- Throws:
IllegalStateException
- if the compiler wasn't passed exactly one file
-
getSourceFileFromPackage
Return the single source file that was compiled in the given package.- Parameters:
packageName
- the package name to check- Returns:
- the single source file
- Throws:
IllegalStateException
- if the compiler wasn't passed exactly one file
-
getSourceFiles
Return all source files that were compiled.- Returns:
- the source files used by the compiler
-
getResourceFile
Return the single resource file that was used when compiled.- Returns:
- the single resource file
- Throws:
IllegalStateException
- if the compiler wasn't passed exactly one file
-
getResourceFiles
Return all resource files that were compiled.- Returns:
- the resource files used by the compiler
-
getInstance
Return a new instance of a compiled class of the given type. There must be only a single instance and it must have a default constructor.- Type Parameters:
T
- the required type- Parameters:
type
- the required type- Returns:
- an instance of type created from the compiled classes
- Throws:
IllegalStateException
- if no instance can be found or instantiated
-
getInstance
Return an instance of a compiled class identified by its class name. The class must have a default constructor.- Type Parameters:
T
- the type to return- Parameters:
type
- the type to returnclassName
- the class name to load- Returns:
- an instance of the class
- Throws:
IllegalStateException
- if no instance can be found or instantiated
-
getAllCompiledClasses
Return all compiled classes.- Returns:
- a list of all compiled classes
-