public interface ObjectType
FactoryObjectGame
.
Usage example:
public enum Type implements ObjectType { TYPE_ONE(TypeOne.class), TYPE_TWO(TypeTwo.class); private final Class<?> target; private final String pathName; private Type(Class<?> target) { this.target = target; pathName = ObjectTypeUtility.getPathName(this); } @Override public Class<?> getTargetClass() { return target; } @Override public String getPathName() { return pathName; } }
SetupGame
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getPathName()
Get the name as a path (which is used to point the XML data file).
|
java.lang.Class<?> |
getTargetClass()
Get the target class (which can be instantiated by a
FactoryObjectGame ). |
java.lang.Class<?> getTargetClass()
FactoryObjectGame
). The target class should have a
constructor like the main one: ObjectGame.ObjectGame(SetupGame)
.java.lang.String getPathName()
ObjectTypeUtility.getPathName(Enum)
can provide a default implementation.