mirror of
https://github.com/Noratrieb/UMLetClassParser.git
synced 2026-01-15 09:05:05 +01:00
working
This commit is contained in:
parent
5b0937a8eb
commit
501fa2f293
6 changed files with 66 additions and 16 deletions
|
|
@ -1,21 +1,42 @@
|
|||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class UMLManager {
|
||||
|
||||
UMLClassView view;
|
||||
|
||||
public UMLManager(UMLClassView view){
|
||||
public UMLManager(UMLClassView view) {
|
||||
this.view = view;
|
||||
view.setManager(this);
|
||||
}
|
||||
|
||||
public void parseClasses(ArrayList<String> classesText){
|
||||
public void parseClasses(ArrayList<String> classesText, String packagePath) {
|
||||
|
||||
String packageString = packagePath.replaceAll(".*src\\\\(.*)", "$1");
|
||||
packageString = packageString.replaceAll("\\\\", ".");
|
||||
|
||||
ArrayList<UMLClass> classes = new ArrayList<>();
|
||||
|
||||
for (String text : classesText){
|
||||
classes.add(new UMLClass(text));
|
||||
for (String text : classesText) {
|
||||
classes.add(new UMLClass(text, packageString));
|
||||
}
|
||||
|
||||
classes.forEach(e -> System.out.println(e.toString()));
|
||||
|
||||
for (UMLClass c : classes) {
|
||||
try {
|
||||
String path = packagePath + "/" + c.getName() + ".java";
|
||||
FileWriter fw = new FileWriter(path);
|
||||
BufferedWriter bw = new BufferedWriter(fw);
|
||||
bw.write(c.toString());
|
||||
bw.close();
|
||||
fw.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue