HHH-5580 - Refactoring

This commit is contained in:
Lukasz Antoniak 2011-06-12 14:15:10 +02:00
parent 13c9fd4f9d
commit f3a6476a66
2 changed files with 8 additions and 7 deletions

View File

@ -304,12 +304,14 @@ public class AuditReaderImpl implements AuditReaderImplementor {
if (revisionInfo != null) {
// If revision exists.
Set<String> entityNames = verCfg.getModifiedEntityNamesReader().getModifiedEntityNames(revisionInfo);
// Generate result that contains entity names and corresponding Java classes.
Set<Pair<String, Class>> result = new HashSet<Pair<String, Class>>();
for (String entityName : entityNames) {
result.add(Pair.make(entityName, Tools.getEntityClass(sessionImplementor, session, entityName)));
if (entityNames != null) {
// Generate result that contains entity names and corresponding Java classes.
Set<Pair<String, Class>> result = new HashSet<Pair<String, Class>>();
for (String entityName : entityNames) {
result.add(Pair.make(entityName, Tools.getEntityClass(sessionImplementor, session, entityName)));
}
return result;
}
return result;
}
return Collections.EMPTY_SET;
}

View File

@ -21,7 +21,6 @@ public class ModifiedEntityNamesReader {
@SuppressWarnings({"unchecked"})
public Set<String> getModifiedEntityNames(Object revisionEntity) {
Set<String> modifiedEntityNames = (Set<String>) modifiedEntityNamesGetter.get(revisionEntity);
return modifiedEntityNames != null ? modifiedEntityNames : Collections.EMPTY_SET;
return (Set<String>) modifiedEntityNamesGetter.get(revisionEntity);
}
}