Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. import com.google.common.collect.Maps;
  2.  
  3. public enum ServiceType {
  4. SOME_SERVICE (4, SomeServiceEntity.class);
  5.  
  6. private int id;
  7. private Class<? extends ServiceEntity> entityClass;
  8.  
  9. private static final Map<Integer, ServiceType> LOOKUP = Maps.uniqueIndex(
  10. Arrays.asList(ServiceType.values()),
  11. ServiceType::getId <<=======
  12. );
  13.  
  14. ServiceType(int id, Class<? extends ServiceEntity> entityClass) {
  15. this.id = id;
  16. this.entityClass = entityClass;
  17. }
  18.  
  19. public int getId() {
  20. return id;
  21. }
  22.  
  23. // and other methods....
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement