EventWrapperWiFiDirect.java 637 B

123456789101112131415161718192021222324252627282930
  1. package com.epson.mobilephone.common.wifidirect;
  2. import androidx.annotation.Nullable;
  3. public class EventWrapperWiFiDirect<T> {
  4. private boolean handled = false;
  5. private T mContent;
  6. public EventWrapperWiFiDirect(T t) {
  7. if (t != null) {
  8. mContent = t;
  9. return;
  10. }
  11. throw new IllegalArgumentException("null values in Event are not allowed.");
  12. }
  13. @Nullable
  14. public T getEventContent() {
  15. if (handled) {
  16. return null;
  17. }
  18. handled = true;
  19. return mContent;
  20. }
  21. public boolean hasBeenHandled() {
  22. return handled;
  23. }
  24. }