Added missing nullness annotations to discovery events (#1621)

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
Christoph Weitkamp 2020-09-04 09:07:54 +02:00 committed by GitHub
parent 72a5afadce
commit f7c8505d7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 6 deletions

View File

@ -14,6 +14,7 @@ package org.openhab.core.config.discovery.inbox;
import java.util.function.Predicate;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.config.discovery.DiscoveryResult;
import org.openhab.core.config.discovery.internal.AutomaticInboxProcessor;
import org.osgi.service.component.annotations.Component;
@ -34,6 +35,7 @@ import org.osgi.service.component.annotations.Component;
*
* @author Henning Sudbrock - Initial contribution
*/
@NonNullByDefault
public interface InboxAutoApprovePredicate extends Predicate<DiscoveryResult> {
}

View File

@ -12,6 +12,7 @@
*/
package org.openhab.core.config.discovery.inbox.events;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.config.discovery.dto.DiscoveryResultDTO;
import org.openhab.core.config.discovery.inbox.Inbox;
import org.openhab.core.events.AbstractEvent;
@ -22,6 +23,7 @@ import org.openhab.core.events.AbstractEvent;
*
* @author Stefan Bußweiler - Initial contribution
*/
@NonNullByDefault
public abstract class AbstractInboxEvent extends AbstractEvent {
private final DiscoveryResultDTO discoveryResult;

View File

@ -12,6 +12,7 @@
*/
package org.openhab.core.config.discovery.inbox.events;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.config.discovery.dto.DiscoveryResultDTO;
/**
@ -20,6 +21,7 @@ import org.openhab.core.config.discovery.dto.DiscoveryResultDTO;
*
* @author Stefan Bußweiler - Initial contribution
*/
@NonNullByDefault
public class InboxAddedEvent extends AbstractInboxEvent {
/**

View File

@ -12,9 +12,10 @@
*/
package org.openhab.core.config.discovery.inbox.events;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.discovery.DiscoveryResult;
import org.openhab.core.config.discovery.dto.DiscoveryResultDTO;
import org.openhab.core.config.discovery.dto.DiscoveryResultDTOMapper;
@ -28,6 +29,7 @@ import org.osgi.service.component.annotations.Component;
*
* @author Stefan Bußweiler - Initial contribution
*/
@NonNullByDefault
@Component(immediate = true, service = EventFactory.class)
public class InboxEventFactory extends AbstractEventFactory {
@ -41,12 +43,12 @@ public class InboxEventFactory extends AbstractEventFactory {
* Constructs a new InboxEventFactory.
*/
public InboxEventFactory() {
super(Stream.of(InboxAddedEvent.TYPE, InboxUpdatedEvent.TYPE, InboxRemovedEvent.TYPE)
.collect(Collectors.toSet()));
super(Set.of(InboxAddedEvent.TYPE, InboxUpdatedEvent.TYPE, InboxRemovedEvent.TYPE));
}
@Override
protected Event createEventByType(String eventType, String topic, String payload, String source) throws Exception {
protected Event createEventByType(String eventType, String topic, String payload, @Nullable String source)
throws Exception {
if (InboxAddedEvent.TYPE.equals(eventType)) {
return createAddedEvent(topic, payload);
} else if (InboxRemovedEvent.TYPE.equals(eventType)) {

View File

@ -12,6 +12,7 @@
*/
package org.openhab.core.config.discovery.inbox.events;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.config.discovery.dto.DiscoveryResultDTO;
/**
@ -20,6 +21,7 @@ import org.openhab.core.config.discovery.dto.DiscoveryResultDTO;
*
* @author Stefan Bußweiler - Initial contribution
*/
@NonNullByDefault
public class InboxRemovedEvent extends AbstractInboxEvent {
/**

View File

@ -12,6 +12,7 @@
*/
package org.openhab.core.config.discovery.inbox.events;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.config.discovery.dto.DiscoveryResultDTO;
/**
@ -20,6 +21,7 @@ import org.openhab.core.config.discovery.dto.DiscoveryResultDTO;
*
* @author Stefan Bußweiler - Initial contribution
*/
@NonNullByDefault
public class InboxUpdatedEvent extends AbstractInboxEvent {
/**