java - creating enum constants with all class types? -
i have create emum wih class types.
enum should contain:
employee.class boarding.class address.class salary.class
how can create enum above constants?
thanks!
enums own type, can't other class types. want enum holds reference other classes. maybe this.
public enum thing { employee(employee.class), boarding(boarding.class), address(address.class), salary(salary.class); private final class clazz; thing(class clazz) { this.clazz = clazz; } public class getclassofthing() { return clazz; } }
you might come better names though.
Comments
Post a Comment