Skip to content

Instantly share code, notes, and snippets.

@maxov
Created December 6, 2014 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxov/1ebfd29f226fac4ab0cf to your computer and use it in GitHub Desktop.
Save maxov/1ebfd29f226fac4ab0cf to your computer and use it in GitHub Desktop.
Tada
interface Registries extends Registry<String, Registry> {
void addChild(Registries child);
}
interface Registry<K, V> {
Set<V> getValues();
Optional<V> get(K key);
}
interface HorseTypeRegistry extends Registry<String, HorseType> {
}
class GameRegistries extends Registries {
GameRegistries() {
}
}
class EntityRegistries extends Registries {
EntityRegistries() {
addChild(new GameRegistries);
add(new HorseTypeRegistry);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment