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:
@@ -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() +
|
||||
|
||||
Reference in New Issue
Block a user