Reworked reflection code in Transaction static init to appease Maven compiler!?

This commit is contained in:
catbref 2019-01-25 15:56:17 +00:00
parent 6eb3520295
commit 79b3074d01

View File

@ -89,22 +89,21 @@ public abstract class Transaction {
this.className = String.join("", classNameParts);
Class<?> clazz = null;
Constructor<?> constructor = null;
try {
clazz = Class.forName(String.join("", Transaction.class.getPackage().getName(), ".", this.className, "Transaction"));
try {
constructor = clazz.getConstructor(Repository.class, TransactionData.class);
} catch (NoSuchMethodException | SecurityException e) {
LOGGER.debug(String.format("Transaction subclass constructor not found for transaction type \"%s\"", this.name()));
}
} catch (ClassNotFoundException e) {
LOGGER.debug(String.format("Transaction subclass not found for transaction type \"%s\"", this.name()));
this.clazz = null;
this.constructor = null;
return;
}
this.clazz = clazz;
Constructor<?> constructor = null;
try {
constructor = this.clazz.getConstructor(Repository.class, TransactionData.class);
} catch (NoSuchMethodException | SecurityException e) {
LOGGER.debug(String.format("Transaction subclass constructor not found for transaction type \"%s\"", this.name()));
}
this.clazz = clazz;
this.constructor = constructor;
}