Skip to content
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

Minor refactoring to DisplayInfo.class #2345

Open
yaRnMcDonuts opened this issue Jan 6, 2025 · 0 comments
Open

Minor refactoring to DisplayInfo.class #2345

yaRnMcDonuts opened this issue Jan 6, 2025 · 0 comments

Comments

@yaRnMcDonuts
Copy link
Member

yaRnMcDonuts commented Jan 6, 2025

Follow up on a review from this previously merged PR #2031 :

"I would suggest privatizing the variables and adding getter/setter methods. Don't use 'record' otherwise you break the engine's compatibility with java 8 and all applications currently out there.

If you think the values of the variables should be immutable, then I would suggest writing the class like this:

public class DisplayInfo {
    
    private long displayID = 0;
    private int width = 1080;
    private int height = 1920;
    private int rate = 60;
    private boolean primary = false;
    private String name = "Generic Monitor";
    
    public DisplayInfo() {}

    public DisplayInfo(long displayID, int width, int height, int rate, boolean primary, String name) {
        this.displayID = displayID;
        this.width = width;
        this.height = height;
        this.rate = rate;
        this.primary = primary;
        this.name = name;
    }

    public long getDisplayID() {
        return displayID;
    }

    public int getWidth() {
        return width;
    }

    public int getHeight() {
        return height;
    }

    public int getRate() {
        return rate;
    }

    public boolean isPrimary() {
        return primary;
    }

    public String getName() {
        return name;
    }
    
}

"

Originally posted by @capdevon in #2031 (comment)

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

No branches or pull requests

1 participant