Last active
August 29, 2015 13:57
-
-
Save eparejatobes/9626743 to your computer and use it in GitHub Desktop.
mutually recursive interfaces and enums for types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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