# 自定义模块
编写java代码如下:
import org.ssssssss.script.annotation.Comment;
@Component //注入到Spring容器中
public class TestFunctions implements MagicModule {
/**
* 返回模块名,使用时通过import指令导入之后使用
*/
@Override
public String getModuleName() {
return "test"; // 模块名称
}
/**
* 调用打印方法
*/
@Comment("方法名的注释(用于提示)")
public void println(@Comment("参数名的提示(用于提示)")String value) {
System.out.println(value);
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
脚本中使用:
import test; //导入模块
test.println('Custom Module!');
1
2
2
← 自定义接口存储 在Java中调用接口 →