class MessageDialogBuilder {
    private String title;
    private String text;
    private final List<MessageDialogButton> buttons;
    private final Set<Window.Hint> extraWindowHints;

    /**
     * Default constructor
     */
    public MessageDialogBuilder() {
        this.title = "MessageDialog";
        this.text = "Text";
        this.buttons = new ArrayList<>();
        this.extraWindowHints = new HashSet<>();
        this.extraWindowHints.add(Window.Hint.CENTERED);
    }

    /**
     * Builds a new {@code MessageDialog} from the properties in the builder
     * @return Newly build {@code MessageDialog}
     */
    public MessageDialog build() {<FILL_FUNCTION_BODY>}

    /**
     * Sets the title of the {@code MessageDialog}
     * @param title New title of the message dialog
     * @return Itself
     */
    public MessageDialogBuilder setTitle(String title) {
        if(title == null) {
            title = "";
        }
        this.title = title;
        return this;
    }

    /**
     * Sets the main text of the {@code MessageDialog}
     * @param text Main text of the {@code MessageDialog}
     * @return Itself
     */
    public MessageDialogBuilder setText(String text) {
        if(text == null) {
            text = "";
        }
        this.text = text;
        return this;
    }

    /**
     * Assigns a set of extra window hints that you want the built dialog to have
     * @param extraWindowHints Window hints to assign to the window in addition to the ones the builder will put
     * @return Itself
     */
    public MessageDialogBuilder setExtraWindowHints(Collection<Window.Hint> extraWindowHints) {
        this.extraWindowHints.clear();
        this.extraWindowHints.addAll(extraWindowHints);
        return this;
    }

    /**
     * Adds a button to the dialog
     * @param button Button to add to the dialog
     * @return Itself
     */
    public MessageDialogBuilder addButton(MessageDialogButton button) {
        if(button != null) {
            buttons.add(button);
        }
        return this;
    }
}

        MessageDialog messageDialog = new MessageDialog(
                title,
                text,
                buttons.toArray(new MessageDialogButton[0]));
        messageDialog.setHints(extraWindowHints);
        return messageDialog;
    
<no_super_class>