From 2fa4e1cc75e583755be7dd99b95659dcd0494b73 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Mon, 21 Jan 2019 17:31:57 +0100 Subject: [PATCH] GH-1556 Added isInput() operation to Binding Resolves #1556 --- .../binder/AbstractMessageChannelBinder.java | 15 +++++++++++++++ .../cloud/stream/binder/Binding.java | 14 ++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinder.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinder.java index 7f0bce482..9849c0f86 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinder.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinder.java @@ -213,6 +213,11 @@ public abstract class AbstractMessageChannelBinder extends Pausable { return null; } - /** * Unbinds the target component represented by this instance and stops any active * components. Implementations must be idempotent. After this method is invoked, the @@ -108,4 +107,15 @@ public interface Binding extends Pausable { * and a new Binding should be created instead. */ void unbind(); + + /** + * Returns boolean flag representing this binding's type. If 'true' this binding is an 'input' binding + * otherwise it is 'output' (as in binding annotated with either @Input or @Output). + * + * @return 'true' if this binding represents an input binding. + */ + default boolean isInput() { + throw new UnsupportedOperationException("Binding implementation `" + this.getClass().getName() + + "` must implement this operation before it is called"); + } }