Skip to content

Conversation

@Sandro642
Copy link
Collaborator

No description provided.

@Sandro642 Sandro642 requested a review from Copilot November 15, 2025 11:31
@Sandro642 Sandro642 self-assigned this Nov 15, 2025
@Sandro642 Sandro642 merged commit c4bdc02 into main Nov 15, 2025
7 checks passed
Copy link
Contributor

Copilot AI left a 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 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
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() {
Copy link

Copilot AI Nov 15, 2025

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
protected Map<?,?> rawPhysx() {
protected Map<?,?> rawPhysx() {
if (apiFactory == null) {
throw new IllegalStateException("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);
Copy link

Copilot AI Nov 15, 2025

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()
Copy link

Copilot AI Nov 15, 2025

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);
Copy link

Copilot AI Nov 15, 2025

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) {
Copy link

Copilot AI Nov 15, 2025

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
public class ClassheritFromFactory extends AtomicFactory {
public ClassheritFromFactory(ApiFactory apiFactory) {
public class ClassInheritFromFactory extends AtomicFactory {
public ClassInheritFromFactory(ApiFactory apiFactory) {

Copilot uses AI. Check for mistakes.
}
}

public class ClassheritFromFactory extends AtomicFactory {
Copy link

Copilot AI Nov 15, 2025

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
public class ClassheritFromFactory extends AtomicFactory {
public static class ClassheritFromFactory extends AtomicFactory {

Copilot uses AI. Check for mistakes.
@Sandro642 Sandro642 deleted the feature/AtomicFactory branch November 15, 2025 11:37
Sign up for free to 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