-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/atomic factory #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces the AtomicFactory pattern to provide a more structured way to handle API responses through inheritance. The main changes include creating a new abstract base class for custom response handlers and refactoring the API to use more conventional method naming.
- New
AtomicFactoryabstract class enabling custom response wrappers via inheritance - Renamed
getResponse()toexecute()for better API semantics - Added example test implementation demonstrating the factory pattern with
thenApplytransformation
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/fr/sandro642/github/provider/AtomicFactory.java | New abstract class providing base functionality for custom API response wrappers |
| src/main/java/fr/sandro642/github/jobs/JobGetInfos.java | Renamed method from getResponse() to execute() for clearer intent |
| src/test/java/fr/sandro642/github/test/MainTest.java | Added test class demonstrating AtomicFactory usage and updated all method calls to use execute() |
| src/main/java/fr/sandro642/github/example/ExampleUsages.java | Removed example file (all lines deleted) |
| build.gradle | Version bumped from 0.4.3.1-STABLE to 0.4.4-DEV_BUILD |
| .github/workflows/work-jar.yml | Updated branch name from Feature/AtomicFactory to feature/AtomicFactory for consistency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| this.apiFactory = apiFactory; | ||
| } | ||
|
|
||
| protected Map<?,?> rawPhysx() { |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rawPhysx() method doesn't check if apiFactory is null before calling getRawData(). If this method is called before getPhysx() is invoked, it will throw a NullPointerException. Consider adding a null check or initializing the field appropriately.
| protected Map<?,?> rawPhysx() { | |
| protected Map<?,?> rawPhysx() { | |
| if (apiFactory == null) { | |
| throw new IllegalStateException("ApiFactory has not been initialized. Call getPhysx() first."); | |
| } |
| .thenApply(ClassheritFromFactory::new); | ||
|
|
||
| System.out.println("Response: " + apiFactory.display()); | ||
| ClassheritFromFactory classheritFromFactory = apiFactoryCompletableFuture.get(5, TimeUnit.SECONDS); |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in variable name: "classherit" should be "classInherit" to match proper spelling and be consistent with the class name correction.
| //.webServices(8080, "TestDashboard"); | ||
|
|
||
| CompletableFuture<ApiFactory> apiFactoryCompletableFuture = connectLib.JobGetInfos() | ||
| CompletableFuture<ClassheritFromFactory> apiFactoryCompletableFuture = connectLib.JobGetInfos() |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in type reference: "ClassheritFromFactory" should be "ClassInheritFromFactory" to match proper spelling.
| ApiFactory apiFactory = apiFactoryCompletableFuture.get(5, TimeUnit.SECONDS); | ||
| .urlBranch(ExampleUrlBranch.POST_PROD) | ||
| .execute() | ||
| .thenApply(ClassheritFromFactory::new); |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in type reference: "ClassheritFromFactory" should be "ClassInheritFromFactory" to match proper spelling.
| public class ClassheritFromFactory extends AtomicFactory { | ||
|
|
||
|
|
||
|
|
||
| public ClassheritFromFactory(ApiFactory apiFactory) { |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in class name: "Classherit" should be "ClassInherit" or "ClassThatInherits". The current name appears to be missing "In" between "Class" and "herit".
| public class ClassheritFromFactory extends AtomicFactory { | |
| public ClassheritFromFactory(ApiFactory apiFactory) { | |
| public class ClassInheritFromFactory extends AtomicFactory { | |
| public ClassInheritFromFactory(ApiFactory apiFactory) { |
| } | ||
| } | ||
|
|
||
| public class ClassheritFromFactory extends AtomicFactory { |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ClassheritFromFactory should be made static, since the enclosing instance is not used.
| public class ClassheritFromFactory extends AtomicFactory { | |
| public static class ClassheritFromFactory extends AtomicFactory { |
No description provided.