forked from iluwatar/java-design-patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
provide an initial module and stubs (iluwatar#79)
- Loading branch information
1 parent
f52f71c
commit fedbb99
Showing
7 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- # this is so-called 'YAML front matter' used to categorize the patterns and format the web pages. Fill it as follows: | ||
title: Best Pattern Ever # the properly formatted title | ||
category: Creational # usable categories and tags are listed here: https://github.com/iluwatar/java-design-patterns/wiki/07.-Categories-and-Tags | ||
language: en # Provide the language in which the pattern is done. Mostly it is in English, so we would put *en* over here. | ||
tag: | ||
- awesome # usable categories and tags are listed here: https://github.com/iluwatar/java-design-patterns/wiki/07.-Categories-and-Tags | ||
- blue | ||
--- | ||
|
||
## Name / classification | ||
|
||
## Also known as | ||
|
||
## Intent | ||
|
||
## Explanation | ||
|
||
## Class diagram | ||
|
||
## Applicability | ||
|
||
## Tutorials | ||
|
||
## Known uses | ||
|
||
## Consequences | ||
|
||
## Related patterns | ||
|
||
## Credits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@startuml | ||
|
||
@enduml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.iluwatar</groupId> | ||
<artifactId>java-design-patterns</artifactId> | ||
<version>1.26.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>active-record</artifactId> | ||
|
||
<properties> | ||
<maven.compiler.source>17</maven.compiler.source> | ||
<maven.compiler.target>17</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.h2database</groupId> | ||
<artifactId>h2</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<mainClass>com.iluwatar.dao.App</mainClass> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
37 changes: 37 additions & 0 deletions
37
active-record/src/main/java/com/iluwatar/activerecord/Customer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.iluwatar.activerecord; | ||
|
||
import java.util.List; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
@RequiredArgsConstructor | ||
@EqualsAndHashCode(onlyExplicitlyIncluded = true) | ||
public class Customer { | ||
|
||
private Long id; | ||
private String customerNumber; | ||
private String firstName; | ||
private String lastName; | ||
private List<Order> orders; | ||
|
||
public Customer findById(Long id) { | ||
return new Customer(); | ||
} | ||
|
||
public Customer findByNumber(String customerNumber) { | ||
return new Customer(); | ||
} | ||
|
||
public List<Customer> findAll() { | ||
return List.of(); | ||
} | ||
|
||
public void save(Customer customer) { | ||
|
||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
active-record/src/main/java/com/iluwatar/activerecord/Order.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.iluwatar.activerecord; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
@EqualsAndHashCode(onlyExplicitlyIncluded = true) | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class Order { | ||
|
||
private Long id; | ||
private String orderNumber; | ||
} |
11 changes: 11 additions & 0 deletions
11
active-record/src/main/java/com/iluwatar/activerecord/RecordBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.iluwatar.activerecord; | ||
|
||
import javax.sql.DataSource; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RequiredArgsConstructor | ||
public abstract class RecordBase { | ||
|
||
private final DataSource dataSource; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters