优化测试
This commit is contained in:
parent
62602b7270
commit
cc4a8a628e
|
|
@ -37,16 +37,16 @@ public class SapMetaPrintTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printMeta(JCoFunction function){
|
private void printMeta(JCoFunction function) {
|
||||||
print("SAP {} 方法参数信息", function.getName());
|
print("SAP {} 方法参数信息", function.getName());
|
||||||
printParameterField("Import",function.getImportParameterList());
|
printParameterField("Import", function.getImportParameterList());
|
||||||
printParameterField("Changing",function.getChangingParameterList());
|
printParameterField("Changing", function.getChangingParameterList());
|
||||||
printParameterField("Export",function.getExportParameterList());
|
printParameterField("Export", function.getExportParameterList());
|
||||||
printParameterField("Table",function.getTableParameterList());
|
printParameterField("Table", function.getTableParameterList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printParameterField(String name, JCoParameterList parameterList){
|
private void printParameterField(String name, JCoParameterList parameterList) {
|
||||||
print("▶ "+name);
|
print("▶ " + name);
|
||||||
if (Objects.nonNull(parameterList)) {
|
if (Objects.nonNull(parameterList)) {
|
||||||
JCoParameterFieldIterator iterator = parameterList.getParameterFieldIterator();
|
JCoParameterFieldIterator iterator = parameterList.getParameterFieldIterator();
|
||||||
if (Objects.nonNull(iterator)) {
|
if (Objects.nonNull(iterator)) {
|
||||||
|
|
@ -55,24 +55,26 @@ public class SapMetaPrintTest {
|
||||||
while (iterator.hasNextField()) {
|
while (iterator.hasNextField()) {
|
||||||
JCoParameterField field = iterator.nextParameterField();
|
JCoParameterField field = iterator.nextParameterField();
|
||||||
data.add(new String[]{field.getName(), field.getTypeAsString(), field.getDescription()});
|
data.add(new String[]{field.getName(), field.getTypeAsString(), field.getDescription()});
|
||||||
if (field.isTable() || field.isStructure()){
|
if (field.isTable() || field.isStructure()) {
|
||||||
fields.add(field);
|
fields.add(field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printTable(data);
|
printTable(data);
|
||||||
fields.forEach(field->{
|
fields.forEach(this::print);
|
||||||
print("★★ {}({}) 参数", field.getName(), field.getDescription());
|
|
||||||
if (field.isTable()){
|
|
||||||
print(field.getTable().getRecordFieldIterator());
|
|
||||||
}else if (field.isStructure()){
|
|
||||||
print(field.getStructure().getRecordFieldIterator());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void print(JCoRecordFieldIterator iterator){
|
private void print(JCoParameterField field) {
|
||||||
|
print("★★ {}({}) 参数", field.getName(), field.getDescription());
|
||||||
|
if (field.isTable()) {
|
||||||
|
print(field.getTable().getRecordFieldIterator());
|
||||||
|
} else if (field.isStructure()) {
|
||||||
|
print(field.getStructure().getRecordFieldIterator());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void print(JCoRecordFieldIterator iterator) {
|
||||||
List<String[]> data = new ArrayList<>();
|
List<String[]> data = new ArrayList<>();
|
||||||
while (iterator.hasNextField()) {
|
while (iterator.hasNextField()) {
|
||||||
JCoRecordField field = iterator.nextRecordField();
|
JCoRecordField field = iterator.nextRecordField();
|
||||||
|
|
@ -81,21 +83,21 @@ public class SapMetaPrintTest {
|
||||||
printTable(data);
|
printTable(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printTable(List<String[]> datas){
|
private void printTable(List<String[]> datas) {
|
||||||
SimpleTable table = new SimpleTable();
|
SimpleTable table = new SimpleTable();
|
||||||
table.addHeader("序号","名称", "类型", "描述");
|
table.addHeader("序号", "名称", "类型", "描述");
|
||||||
for (int i = 0; i < datas.size(); i++){
|
for (int i = 0; i < datas.size(); i++) {
|
||||||
table.addRow(String.valueOf(i+1), datas.get(i)[0], datas.get(i)[1], datas.get(i)[2]);
|
table.addRow(String.valueOf(i + 1), datas.get(i)[0], datas.get(i)[1], datas.get(i)[2]);
|
||||||
}
|
}
|
||||||
table.print();
|
table.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void print(String content){
|
private void print(String content) {
|
||||||
System.out.println(content);
|
System.out.println(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void print(String template,Object... args){
|
private void print(String template, Object... args) {
|
||||||
System.out.println(StrUtil.format(template,args));
|
System.out.println(StrUtil.format(template, args));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 简单实现示例
|
// 简单实现示例
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue