Skip to content

Instantly share code, notes, and snippets.

public abstract class MessageBuilder<B extends MessageBuilder<B>>{
private String name;
private String id;
public abstract Message build();
String getId() {
return id;
}
String getName() {
return name;
}
protected abstract B self();
public B withId(final String id) {
this.id = id;
return self();
}
public B withName(final String name) {
this.name = name;
return self();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment