diff --git a/active-record/src/main/java/com/iluwatar/activerecord/App.java b/active-record/src/main/java/com/iluwatar/activerecord/App.java index b6641875ee71..7e0ec21b6ca9 100644 --- a/active-record/src/main/java/com/iluwatar/activerecord/App.java +++ b/active-record/src/main/java/com/iluwatar/activerecord/App.java @@ -5,6 +5,9 @@ import lombok.extern.slf4j.Slf4j; import org.h2.jdbcx.JdbcDataSource; +/** + * The amin application for the manual testing purposes. + */ @Slf4j public class App { @@ -28,7 +31,12 @@ public class App { + " CONSTRAINT customer_id_fk FOREIGN KEY (customer_id) REFERENCES customer (id)\n" + ")"; - + /** + * Java main method to execute all the logic out there. + * + * @param args arguments. + * @throws Exception Any sort of exception that have to be picked up by the JVM. + */ public static void main(final String[] args) throws Exception { final var dataSource = createDataSource(); createSchema(dataSource); @@ -48,7 +56,7 @@ private static void executeOperation() { order.setId(1L); order.setOrderNumber("O123"); -// customer.addOrder(order); + // customer.addOrder(order); customer.save(); LOGGER.info("The customer data by ID={}", customer.findById(1L)); diff --git a/active-record/src/main/java/com/iluwatar/activerecord/Customer.java b/active-record/src/main/java/com/iluwatar/activerecord/Customer.java index 45fa7124cfe4..d179c26bd8ba 100644 --- a/active-record/src/main/java/com/iluwatar/activerecord/Customer.java +++ b/active-record/src/main/java/com/iluwatar/activerecord/Customer.java @@ -8,6 +8,9 @@ import lombok.Setter; import lombok.ToString; +/** + * The customer domain model. + */ @Getter @Setter @ToString diff --git a/active-record/src/main/java/com/iluwatar/activerecord/Order.java b/active-record/src/main/java/com/iluwatar/activerecord/Order.java index 8de6371cb3c1..4d77b90fcbe3 100644 --- a/active-record/src/main/java/com/iluwatar/activerecord/Order.java +++ b/active-record/src/main/java/com/iluwatar/activerecord/Order.java @@ -6,6 +6,9 @@ import lombok.NoArgsConstructor; import lombok.Setter; +/** + * An order domain model. + */ @Getter @Setter @EqualsAndHashCode(onlyExplicitlyIncluded = true) diff --git a/active-record/src/main/java/com/iluwatar/activerecord/RecordBase.java b/active-record/src/main/java/com/iluwatar/activerecord/RecordBase.java index dd6436c7ebdf..1aa748c7c402 100644 --- a/active-record/src/main/java/com/iluwatar/activerecord/RecordBase.java +++ b/active-record/src/main/java/com/iluwatar/activerecord/RecordBase.java @@ -11,6 +11,11 @@ import lombok.RequiredArgsConstructor; import lombok.Setter; +/** + * An active record base supposed to hold all the necessary active record pattern logic. + * + * @param an active record type. + */ @RequiredArgsConstructor public abstract class RecordBase> { @@ -117,8 +122,10 @@ private String constructFindByIdQuery() { private T getDeclaredClassInstance() { try { return clazz.getDeclaredConstructor().newInstance(); - } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException | - InstantiationException e) { + } catch (InvocationTargetException + | NoSuchMethodException + | IllegalAccessException + | InstantiationException e) { throw new IllegalStateException( "Unable to create a new instance of the class=" + clazz.getName(), e); }