public class DynamicCompilerManager extends Object
Constructor and Description |
---|
DynamicCompilerManager() |
Modifier and Type | Method and Description |
---|---|
static DynamicClass |
addClazz(DynamicClass dynamicClass)
增加一个动态类
|
static DynamicClass |
addClazz(File file)
增加一个动态类
|
static DynamicClass |
addClazz(File file,
String charSet)
增加一个动态类
|
static DynamicClass |
addClazz(String name,
String code)
增加一个动态类
|
static DynamicFunction |
addFunction(DynamicFunction dynamicFunction)
增加一个动态函数
|
static DynamicFunction |
addFunction(File file)
增加一个动态函数
|
static DynamicFunction |
addFunction(File file,
String charSet)
增加一个动态函数
|
static DynamicFunction |
addFunction(String name,
String code)
增加一个动态函数
|
static Object |
callFunction(String name,
Object... args)
调用动态函数
|
static DynamicClass |
getClazz(String name)
获取一个动态类
|
static Map<String,DynamicClass> |
getClazzs()
获取动态类集合
|
static Map<String,DynamicFunction> |
getFunctions()
获取动态函数集合
|
static DynamicFunction |
getFunctions(String name)
获取动态函数
|
static <T> T |
newInstance(String name,
Object... args)
获取一个动态类的实例
|
static void |
removeClazz(String name)
移除一个动态类
|
static void |
removeFunctions(String name)
移除一个动态函数
|
public static DynamicFunction addFunction(File file, String charSet) throws UnsupportedEncodingException, ReflectiveOperationException
file
- 文件对象charSet
- 字符集UnsupportedEncodingException
- 字符集异常ReflectiveOperationException
- 反射异常public static DynamicFunction addFunction(File file) throws UnsupportedEncodingException, ReflectiveOperationException
file
- 文件对象UnsupportedEncodingException
- 字符集异常ReflectiveOperationException
- 反射异常public static DynamicFunction addFunction(String name, String code) throws ReflectiveOperationException
name
- 动态函数名称code
- 动态函数代码ReflectiveOperationException
- 反射异常public static DynamicFunction addFunction(DynamicFunction dynamicFunction)
dynamicFunction
- 动态函数对象public static DynamicFunction getFunctions(String name)
name
- 动态函数名称public static void removeFunctions(String name)
name
- 动态函数名称public static Map<String,DynamicFunction> getFunctions()
public static Object callFunction(String name, Object... args) throws Exception
name
- 动态函数名称args
- 动态函数调用的参数ReflectiveOperationException
- 反射异常Exception
public static DynamicClass addClazz(File file, String charSet) throws UnsupportedEncodingException, Exception
file
- 文件对象charSet
- 字符集UnsupportedEncodingException
- 字符集异常ReflectiveOperationException
- 反射异常Exception
public static DynamicClass addClazz(File file) throws UnsupportedEncodingException, ReflectiveOperationException
file
- 文件对象UnsupportedEncodingException
- 字符集异常ReflectiveOperationException
- 反射异常public static DynamicClass addClazz(String name, String code) throws ReflectiveOperationException
name
- 动态类命名code
- 动态类代码ReflectiveOperationException
- 反射异常public static DynamicClass addClazz(DynamicClass dynamicClass)
dynamicClass
- 动态类对象public static DynamicClass getClazz(String name)
name
- 动态类名称public static void removeClazz(String name)
name
- 动态类名称public static Map<String,DynamicClass> getClazzs()
public static <T> T newInstance(String name, Object... args) throws ReflectiveOperationException
T
- 范型name
- 动态类名称args
- 动态类构造方法的参数ReflectiveOperationException
- 反射异常Copyright © 2020 Voovan. All rights reserved.