Skip to content

Instantly share code, notes, and snippets.

@eparejatobes
Last active August 29, 2015 13:57
Show Gist options
  • Save eparejatobes/9626743 to your computer and use it in GitHub Desktop.
Save eparejatobes/9626743 to your computer and use it in GitHub Desktop.
mutually recursive interfaces and enums for types
interface reltype<t extends Enum<t> & reltype<t,r>, r extends rel<r,t>> {
public t value();
}
interface rel<r extends rel<r,t>, t extends Enum<t> & reltype<t,r>> {
public t getType();
}
// use it
interface Knows extends rel<Knows, KNOWS> {
public KNOWS getType();
}
enum KNOWS implements reltype<TaxonRelType, TaxonRel> {
INSTANCE; public KNOWS value() { return INSTANCE; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment