public class IntercessorUtils
extends java.lang.Object
Constructor and Description |
---|
IntercessorUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
checkVisibility(java.lang.Class<?> clazz,
java.lang.String name)
Checks if there is any attribute in the last version of the class that
matches with the data provided and its visibility is public.
|
static void |
checkVisibility(java.lang.Class<?> clazz,
java.lang.String name,
java.lang.Class<?> methodInterface,
int modifiers,
java.lang.Class<?>[] parametrizationClasses)
Checks if any method matches the provided functional interface method in the
last version of the class.
|
static <T> T |
compileFile(java.io.File file,
java.lang.String name,
java.lang.String packageName)
Compiles a class file and return an instance of the compiled class.
|
static void |
resetLibraryState()
This method clears the source code cache, so previously modified classes are
not taken into account when performing "unsafe" operations (those that may
produce errors with external classes that call the modified classes, such as
deleting methods or modifying the hierarchy of a class).
|
public static <T> T compileFile(java.io.File file, java.lang.String name, java.lang.String packageName) throws CompilationFailedException, StructuralIntercessionException
Class
instance.file
- The file of the classname
- The name of the classpackageName
- The package of the classCompilationFailedException
- If the class have compilation errorsStructuralIntercessionException
- If some errors ocurrsjava.lang.RuntimeException
- If there are errors accesing the files, obtaining the class or
creating the instancepublic static void checkVisibility(java.lang.Class<?> clazz, java.lang.String name, java.lang.Class<?> methodInterface, int modifiers, java.lang.Class<?>[] parametrizationClasses) throws java.lang.NoSuchMethodException
clazz
- The original classname
- The name of the methodmethodInterface
- The functional interfacemodifiers
- The modifiers of the methodparametrizationClasses
- The classes that parametrize the interfacejava.lang.NoSuchMethodException
- If no method matches the functional interface method in the last
version of the classpublic static void checkVisibility(java.lang.Class<?> clazz, java.lang.String name) throws java.lang.NoSuchFieldException
clazz
- The original classname
- The name of the fieldjava.lang.NoSuchFieldException
- If the field isn't public or doesn't existpublic static void resetLibraryState()