[Solved] Singleton design pattern [closed]


This is one simple example for your singleton. Feel free to add setters and getters as you need it for the fields.
I’m not sure what the set-method in your diagram should do but maybe you don’t need it anyway.

public class LibraryInfo {
    private static final LibraryInfo instance = new LibraryInfo();
    public static LibraryInfo getInstance() {
        return instance;
    }
    private LibraryInfo() {}

    private String name;
    private int phone;
    private String address;
    private String openTime;
    private String closeTime;

    // getters
}

solved Singleton design pattern [closed]