Skip to content

Instantly share code, notes, and snippets.

Ray Ryan rjrjr

Block or report user

Report or block rjrjr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rjrjr / java-sealed-class
Last active Jun 28, 2019
Poor Man's Sealed Classes (visitor pattern)
View java-sealed-class
* For Java developers all excited by and jealous of Kotlin's sealed classes.
* Do this when you wish you could put parameters on an enum.
public class PoorMan {
interface Event {
<T> T dispatch(EventHandler<T> handler);
interface EventHandler<T> {
package mortar;
import android.view.View;
import mortar.bundler.BundleService;
public class NewViewPresenter<V extends View> extends NewPresenter<V> {
@Override protected final MortarScope extractScope(V view) {
return MortarScope.getScope(view.getContext());
package mortar;
public abstract class NewPresenter<V> {
private V view = null;
private Scoped registration = new Scoped() {
@Override public void onEnterScope(MortarScope scope) {
You can’t perform that action at this time.