* whether we sould generate given class. we generate if class contains
* hibernate.class tag on it. class could be as well abstract, because real
* stuff lives in polymorphic subclasses
*/
public boolean shouldGenerate(Object metadata) {
JavaClass clazz = (JavaClass) metadata;
//Check if mapping up-to-date then skip generation
if (!force) {
String packagePath = getDestinationPackage(metadata).replace('.', '/');
File dir = new File(getDestdirFile(), packagePath);
String filename = getDestinationFilename(metadata);
File destFile = new File(dir, filename);
File sourceFile = new File(clazz.getSource().getURL().getFile());
if (destFile.exists() && sourceFile.lastModified() < destFile.lastModified()) {
return false;
}
}
// we refuse to generate if object is in restricted folder
if(!super.shouldGenerate(metadata)) {
return false;
}
boolean generate = clazz.getTagByName("hibernate.class") != null;
if (generate) {
System.out.println(" * Generate mapping for '" + clazz.getName() + "' entity");
}
return generate;
}