parent
fcf593c13c
commit
6846f91aad
@ -0,0 +1,47 @@
|
||||
package xyz.wbsite.dbtool.javafx.tool;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class DocRequestReader extends RequestReader {
|
||||
private Map<String, String> fieldDocMap;
|
||||
|
||||
public DocRequestReader(File javaClass) {
|
||||
super(javaClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void read() {
|
||||
super.read();
|
||||
fieldDocMap = new HashMap<>();
|
||||
String doc = null;
|
||||
String field = null;
|
||||
for (String s : getBody()) {
|
||||
if (s.matches("\\s+/\\*(\\*)?(.*)(\\*/)?")) {
|
||||
Pattern compile = Pattern.compile("\\s+/\\*(\\*)?(.*)(\\*/)?");
|
||||
Matcher matcher = compile.matcher(s);
|
||||
if (matcher.find()) {
|
||||
doc = matcher.group(2);
|
||||
} else {
|
||||
doc = "";
|
||||
}
|
||||
}
|
||||
|
||||
if (s.matches("\\s+\\*\\s+(.*)")) {
|
||||
Pattern compile = Pattern.compile("\\s+\\*\\s+(.*)");
|
||||
Matcher matcher = compile.matcher(s);
|
||||
if (matcher.find()) doc += matcher.group(1);
|
||||
}
|
||||
|
||||
if (s.matches("\\s+private\\s.*\\s(.*);")) {
|
||||
Pattern compile = Pattern.compile("\\s+private\\s.*\\s(.*);");
|
||||
Matcher matcher = compile.matcher(s);
|
||||
if (matcher.find()) field = matcher.group(1);
|
||||
fieldDocMap.put(field, doc != null ? doc : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue