Skip to content

Minor refactoring to DisplayInfo.class #2345

Closed
@yaRnMcDonuts

Description

@yaRnMcDonuts

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions