public static void main(java.lang.String[] args) {
try {
printBanner();
ArgumentParser parser = new ArgumentParser(args);
String outputPath = parser.getOutputPath();
FileSourceCodeMaker maker = new FileSourceCodeMaker(outputPath);
List interfaceNames = parser.getInterfaceNames();
if (interfaceNames.size() == 0) {
System.err.println("No interface(s) or class(es) provided");
System.err.println();
printUsage();
System.exit(1);
}
Iterator it = interfaceNames.iterator();
while (it.hasNext()) {
String interfaceName = (String) it.next();
MockDescriptor md = new MockDescriptor(interfaceName);
// FIXME: that's stupid; we shall determine Mock by MockDescriptor
// stamp
if (md.name.startsWith("Mock")) {
md = new MockDescriptor(interfaceName, null, true);
System.out.print("updating " + md.getSourceFQN());
} else {
System.out.print("mocking " + md.getSourceFQN());
}
String targetPackage = parser.getTargetPackage();
if (targetPackage != null && targetPackage.length() != 0) {
md.setTargetPackageName(targetPackage);
}
if (!parser.getSkipUptodate() || !maker.isUpToDate(md)) {
if (!md.isInterface()) {
System.out.print(" (warning: not an interface)");
}
maker.save(md, MockCreator.createMock(md));