Skip to content

Instantly share code, notes, and snippets.

@todesking
Created July 5, 2011 05:51
Show Gist options
  • Save todesking/1064305 to your computer and use it in GitHub Desktop.
Save todesking/1064305 to your computer and use it in GitHub Desktop.
public enum NamedParam {
A(new Param1(1), new Param2("hoge")), B(new Param1(10), new Param2("fuga"));
X(Param1 p1, Param2 p2) {
this.p1 = p1.value;
this.p2 = p2.value;
}
public final int p1;
public final String p2;
protected static class Value<T> {
public Value(T value) {
this.value = value;
}
public final T value;
}
protected static class Param1 extends Value<Integer> {
public Param1(int x) {
super(x);
}
}
protected static class Param2 extends Value<String> {
public Param2(String x) {
super(x);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment