Im trying to use the type of one variable to define the type on another I know i could just put all the types in an enum then use ordinal with a switch/case to select but i'm wondering if theres an easier way.
Heres a small example:
public void loadRotation(TetrominoType type) {
TetrominoType new = new type.class();
}
TetroiminoType type = new RedTetro();
this.loadRotation(type);
RedTetro obviously extends TetrminoType
I know this won't work but hopefully from it you understand what i'm trying to do.
Object.getClass()method and follow the links from there -- which would allow reflection utilization. Other options include passing in aClass<...>or using a "factory pattern".