GH-3340: IntegrationEvents - add getSourceAsType()

Resolves https://github.com/spring-projects/spring-integration/issues/3340

- add common super-interface for MQTT components
- add `getConnectionInfo()` so users can examine server URIs etc

* Reinstate per-adapter URIs - support multiple

* Restore single URL per adapter.

* Code cleanup for previous commit.
This commit is contained in:
Gary Russell
2020-07-21 16:29:23 -04:00
committed by GitHub
parent 5be0ed17eb
commit 40b0031e0f
12 changed files with 243 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2019 the original author or authors.
* Copyright 2013-2020 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.
@@ -48,6 +48,18 @@ public abstract class IntegrationEvent extends ApplicationEvent {
return this.cause;
}
/**
* Get the source as a specific type; the receiving variable must be declared with the
* correct type.
* @param <T> the type.
* @return the source.
* @since 5.4
*/
@SuppressWarnings("unchecked")
public <T> T getSourceAsType() {
return (T) getSource();
}
@Override
public String toString() {
return this.getClass().getSimpleName() + " [source=" + this.getSource() +