Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.google.common.collect.Maps;
- public enum ServiceType {
- SOME_SERVICE (4, SomeServiceEntity.class);
- private int id;
- private Class<? extends ServiceEntity> entityClass;
- private static final Map<Integer, ServiceType> LOOKUP = Maps.uniqueIndex(
- Arrays.asList(ServiceType.values()),
- ServiceType::getId <<=======
- );
- ServiceType(int id, Class<? extends ServiceEntity> entityClass) {
- this.id = id;
- this.entityClass = entityClass;
- }
- public int getId() {
- return id;
- }
- // and other methods....
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement