Skip to content

Instantly share code, notes, and snippets.

@fge
Created March 3, 2015 14:36
Show Gist options
  • Save fge/93ceae333c7c4ef12dfb to your computer and use it in GitHub Desktop.
Save fge/93ceae333c7c4ef12dfb to your computer and use it in GitHub Desktop.
package com.github.fge.lambdas.v2;
public abstract class Chain<N, T extends N, C extends Chain<N, T, C>>
{
protected final T throwing;
protected Chain(final T throwing)
{
this.throwing = throwing;
}
public abstract C orTryWith(T other);
public abstract <E extends RuntimeException> T orThrow(Class<E> exclass);
public abstract N fallbackTo(N fallback);
public final <E extends RuntimeException> T as(final Class<E> exclass)
{
return orThrow(exclass);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment