General cleanup
- Deprecated BindableAdapter in favor of providing default operations in Bindable - Removed 'postProcessBeforeInitialization(..)' from 'BinderAwareRouterBeanPostProcessor' as it is no longer required
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.stream.binding;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -24,37 +25,42 @@ import java.util.Set;
|
||||
* Intended for internal use.
|
||||
*
|
||||
* @author Marius Bogoevici
|
||||
* @author Oleg Zhurakousky
|
||||
*/
|
||||
public interface Bindable {
|
||||
|
||||
/**
|
||||
* Binds all the inputs associated with this instance.
|
||||
*/
|
||||
void bindInputs(BindingService adapter);
|
||||
default void bindInputs(BindingService adapter) {}
|
||||
|
||||
/**
|
||||
* Binds all the outputs associated with this instance.
|
||||
*/
|
||||
void bindOutputs(BindingService adapter);
|
||||
default void bindOutputs(BindingService adapter) {}
|
||||
|
||||
/**
|
||||
* Unbinds all the inputs associated with this instance.
|
||||
*/
|
||||
void unbindInputs(BindingService adapter);
|
||||
default void unbindInputs(BindingService adapter) {}
|
||||
|
||||
/**
|
||||
* Unbinds all the outputs associated with this instance.
|
||||
*/
|
||||
void unbindOutputs(BindingService adapter);
|
||||
default void unbindOutputs(BindingService adapter) {}
|
||||
|
||||
/**
|
||||
* Enumerates all the input binding names.
|
||||
*/
|
||||
Set<String> getInputs();
|
||||
default Set<String> getInputs() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerates all the output binding names.
|
||||
*/
|
||||
Set<String> getOutputs();
|
||||
default Set<String> getOutputs() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,10 @@ import java.util.Set;
|
||||
* Default adapter implementation for {@Bindable}.
|
||||
*
|
||||
* @author Ilayaperumal Gopinathan
|
||||
*
|
||||
* @deprecated as of version 2.0. Use {@link Bindable} interface instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public class BindableAdapter implements Bindable {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2015 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,11 +37,6 @@ public class BinderAwareRouterBeanPostProcessor implements BeanPostProcessor {
|
||||
this.channelResolver = channelResolver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
if (bean instanceof AbstractMappingMessageRouter) {
|
||||
|
||||
@@ -31,12 +31,12 @@ import org.springframework.cloud.stream.binder.Binding;
|
||||
*
|
||||
* @author Ilayaperumal Gopinathan
|
||||
*/
|
||||
public final class DynamicDestinationsBindable extends BindableAdapter {
|
||||
public final class DynamicDestinationsBindable implements Bindable {
|
||||
|
||||
/**
|
||||
* Map containing dynamic channel names and their bindings.
|
||||
*/
|
||||
private Map<String, Binding<?>> outputBindings = new HashMap<>();
|
||||
private final Map<String, Binding<?>> outputBindings = new HashMap<>();
|
||||
|
||||
public void addOutputBinding(String name, Binding<?> binding) {
|
||||
this.outputBindings.put(name, binding);
|
||||
|
||||
Reference in New Issue
Block a user