Skip to content

Feature/atomic factory - #59

Merged
Sandro642 merged 3 commits into
mainfrom
feature/AtomicFactory
Nov 15, 2025
Merged

Feature/atomic factory#59
Sandro642 merged 3 commits into
mainfrom
feature/AtomicFactory

Conversation

@Sandro642

Copy link
Copy Markdown
Collaborator

No description provided.

@Sandro642Sandro642 self-assigned this Nov 15, 2025
@Sandro642
Sandro642 merged commit c4bdc02 into mainNov 15, 2025
7 checks passed

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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 AtomicFactory abstract class enabling custom response wrappers via inheritance
  • Renamed getResponse() to execute() for better API semantics
  • Added example test implementation demonstrating the factory pattern with thenApply transformation

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
FileDescription
src/main/java/fr/sandro642/github/provider/AtomicFactory.javaNew abstract class providing base functionality for custom API response wrappers
src/main/java/fr/sandro642/github/jobs/JobGetInfos.javaRenamed method from getResponse() to execute() for clearer intent
src/test/java/fr/sandro642/github/test/MainTest.javaAdded test class demonstrating AtomicFactory usage and updated all method calls to use execute()
src/main/java/fr/sandro642/github/example/ExampleUsages.javaRemoved example file (all lines deleted)
build.gradleVersion bumped from 0.4.3.1-STABLE to 0.4.4-DEV_BUILD
.github/workflows/work-jar.ymlUpdated 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() {

CopilotAINov 15, 2025

Copy link

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.

Suggested change
protectedMap<?,?> rawPhysx() {
protectedMap<?,?> rawPhysx() {
if (apiFactory == null) {
thrownewIllegalStateException("ApiFactory has not been initialized. Call getPhysx() first.");
}

Copilot uses AI. Check for mistakes.
.thenApply(ClassheritFromFactory::new);

System.out.println("Response: " + apiFactory.display());
ClassheritFromFactory classheritFromFactory = apiFactoryCompletableFuture.get(5, TimeUnit.SECONDS);

CopilotAINov 15, 2025

Copy link

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.

Copilot uses AI. Check for mistakes.
//.webServices(8080, "TestDashboard");

CompletableFuture<ApiFactory> apiFactoryCompletableFuture = connectLib.JobGetInfos()
CompletableFuture<ClassheritFromFactory> apiFactoryCompletableFuture = connectLib.JobGetInfos()

CopilotAINov 15, 2025

Copy link

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.

Copilot uses AI. Check for mistakes.
ApiFactory apiFactory = apiFactoryCompletableFuture.get(5, TimeUnit.SECONDS);
.urlBranch(ExampleUrlBranch.POST_PROD)
.execute()
.thenApply(ClassheritFromFactory::new);

CopilotAINov 15, 2025

Copy link

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.

Copilot uses AI. Check for mistakes.
Comment on lines +47 to +51
public class ClassheritFromFactory extends AtomicFactory {



public ClassheritFromFactory(ApiFactory apiFactory) {

CopilotAINov 15, 2025

Copy link

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".

Suggested change
publicclassClassheritFromFactoryextendsAtomicFactory {
publicClassheritFromFactory(ApiFactoryapiFactory) {
publicclassClassInheritFromFactoryextendsAtomicFactory {
publicClassInheritFromFactory(ApiFactoryapiFactory) {

Copilot uses AI. Check for mistakes.
}
}

public class ClassheritFromFactory extends AtomicFactory {

CopilotAINov 15, 2025

Copy link

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.

Suggested change
publicclassClassheritFromFactoryextendsAtomicFactory {
publicstaticclassClassheritFromFactoryextendsAtomicFactory {

Copilot uses AI. Check for mistakes.
@Sandro642
Sandro642 deleted the feature/AtomicFactory branch November 15, 2025 11:37
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@Sandro642