|
@@ -58,6 +58,12 @@ public final class EventFactory {
|
|
return new EventImpl<>(function);
|
|
return new EventImpl<>(function);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @SafeVarargs
|
|
|
|
+ public static <T> Event<T> createLoop(T... typeGetter) {
|
|
|
|
+ if (typeGetter.length != 0) throw new IllegalStateException("array must be empty!");
|
|
|
|
+ return createLoop((Class<T>) typeGetter.getClass().getComponentType());
|
|
|
|
+ }
|
|
|
|
+
|
|
@SuppressWarnings("UnstableApiUsage")
|
|
@SuppressWarnings("UnstableApiUsage")
|
|
public static <T> Event<T> createLoop(Class<T> clazz) {
|
|
public static <T> Event<T> createLoop(Class<T> clazz) {
|
|
return of(listeners -> (T) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{clazz}, new AbstractInvocationHandler() {
|
|
return of(listeners -> (T) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{clazz}, new AbstractInvocationHandler() {
|
|
@@ -71,6 +77,12 @@ public final class EventFactory {
|
|
}));
|
|
}));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @SafeVarargs
|
|
|
|
+ public static <T> Event<T> createInteractionResult(T... typeGetter) {
|
|
|
|
+ if (typeGetter.length != 0) throw new IllegalStateException("array must be empty!");
|
|
|
|
+ return createInteractionResult((Class<T>) typeGetter.getClass().getComponentType());
|
|
|
|
+ }
|
|
|
|
+
|
|
@SuppressWarnings("UnstableApiUsage")
|
|
@SuppressWarnings("UnstableApiUsage")
|
|
public static <T> Event<T> createInteractionResult(Class<T> clazz) {
|
|
public static <T> Event<T> createInteractionResult(Class<T> clazz) {
|
|
return of(listeners -> (T) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{clazz}, new AbstractInvocationHandler() {
|
|
return of(listeners -> (T) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{clazz}, new AbstractInvocationHandler() {
|
|
@@ -87,6 +99,12 @@ public final class EventFactory {
|
|
}));
|
|
}));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @SafeVarargs
|
|
|
|
+ public static <T> Event<T> createInteractionResultHolder(T... typeGetter) {
|
|
|
|
+ if (typeGetter.length != 0) throw new IllegalStateException("array must be empty!");
|
|
|
|
+ return createInteractionResultHolder((Class<T>) typeGetter.getClass().getComponentType());
|
|
|
|
+ }
|
|
|
|
+
|
|
@SuppressWarnings("UnstableApiUsage")
|
|
@SuppressWarnings("UnstableApiUsage")
|
|
public static <T> Event<T> createInteractionResultHolder(Class<T> clazz) {
|
|
public static <T> Event<T> createInteractionResultHolder(Class<T> clazz) {
|
|
return of(listeners -> (T) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{clazz}, new AbstractInvocationHandler() {
|
|
return of(listeners -> (T) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{clazz}, new AbstractInvocationHandler() {
|
|
@@ -103,6 +121,12 @@ public final class EventFactory {
|
|
}));
|
|
}));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @SafeVarargs
|
|
|
|
+ public static <T> Event<Consumer<T>> createConsumerLoop(T... typeGetter) {
|
|
|
|
+ if (typeGetter.length != 0) throw new IllegalStateException("array must be empty!");
|
|
|
|
+ return createConsumerLoop((Class<T>) typeGetter.getClass().getComponentType());
|
|
|
|
+ }
|
|
|
|
+
|
|
@SuppressWarnings("UnstableApiUsage")
|
|
@SuppressWarnings("UnstableApiUsage")
|
|
public static <T> Event<Consumer<T>> createConsumerLoop(Class<T> clazz) {
|
|
public static <T> Event<Consumer<T>> createConsumerLoop(Class<T> clazz) {
|
|
Event<Consumer<T>> event = of(listeners -> (Consumer<T>) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{Consumer.class}, new AbstractInvocationHandler() {
|
|
Event<Consumer<T>> event = of(listeners -> (Consumer<T>) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{Consumer.class}, new AbstractInvocationHandler() {
|
|
@@ -124,6 +148,12 @@ public final class EventFactory {
|
|
return event;
|
|
return event;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @SafeVarargs
|
|
|
|
+ public static <T> Event<Actor<T>> createActorLoop(T... typeGetter) {
|
|
|
|
+ if (typeGetter.length != 0) throw new IllegalStateException("array must be empty!");
|
|
|
|
+ return createActorLoop((Class<T>) typeGetter.getClass().getComponentType());
|
|
|
|
+ }
|
|
|
|
+
|
|
@SuppressWarnings("UnstableApiUsage")
|
|
@SuppressWarnings("UnstableApiUsage")
|
|
public static <T> Event<Actor<T>> createActorLoop(Class<T> clazz) {
|
|
public static <T> Event<Actor<T>> createActorLoop(Class<T> clazz) {
|
|
Event<Actor<T>> event = of(listeners -> (Actor<T>) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{Actor.class}, new AbstractInvocationHandler() {
|
|
Event<Actor<T>> event = of(listeners -> (Actor<T>) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{Actor.class}, new AbstractInvocationHandler() {
|