Guest User

Untitled

a guest
May 25th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. public interface Service {
  2. CompletableFuture<ResponseCar> getResponseOfApple(String url, UUID id);
  3. CompletableFuture<ResponsePear> getResponseOfPear(String url, UUID id);
  4. }
  5.  
  6. @RequiredArgsConstructor
  7. public class PrioritizedQueueElement extends Observable implements Comparable<PrioritizedQueueElement> {
  8.  
  9. @NonNull
  10. @Getter
  11. private final Object argument;
  12.  
  13. @Getter
  14. @Setter
  15. private Object returnValue;
  16.  
  17. @NonNull
  18. @Getter
  19. private final QueueElementType priority;
  20.  
  21.  
  22. @Override
  23. public int compareTo(final PrioritizedQueueElement o) {
  24. if (o == null || this.priority == null || o.priority == null) {
  25. throw new NullPointerException("wrong value");
  26. }
  27.  
  28. return this.priority.compareTo(o.priority);
  29. }
  30.  
  31.  
  32. public <T> T getValue() {
  33. return (T) this.returnValue;
  34. }
  35.  
  36. public void setReturnValue(final Object value) {
  37. this.returnValue = value;
  38. this.setChanged();
  39. this.notifyObservers();
  40. }
  41. }
  42.  
  43. public enum QueueElementType {
  44. ONE_TIME_HIGH_PRIORITY,
  45. ONE_TIME_LOW_PRIORITY,
  46. RECURRENT_HIGH_PRIORITY,
  47. RECURRENT_LOW_PRIORITY
  48. }
Add Comment
Please, Sign In to add comment