12345678910111213141516171819202122232425262728 |
- package epson.common;
- public class EventWrapper<T> {
- private boolean handled = false;
- private T mContent;
- public EventWrapper(T t) {
- if (t != null) {
- mContent = t;
- return;
- }
- throw new IllegalArgumentException("null values in Event are not allowed.");
- }
- @Nullable
- public T getEventContent() {
- if (handled) {
- return null;
- }
- handled = true;
- return mContent;
- }
- public boolean hasBeenHandled() {
- return handled;
- }
- }
|