Added missing nullness annotations in profile implementations (#1614)

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
Christoph Weitkamp 2020-08-30 14:02:23 +02:00 committed by GitHub
parent 12a5d08691
commit a87318aace
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View File

@ -14,6 +14,7 @@ package org.openhab.core.thing.internal.profiles;
import java.util.function.Function; import java.util.function.Function;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.common.SafeCaller; import org.openhab.core.common.SafeCaller;
import org.openhab.core.events.EventPublisher; import org.openhab.core.events.EventPublisher;
import org.openhab.core.items.Item; import org.openhab.core.items.Item;
@ -39,6 +40,7 @@ import org.slf4j.LoggerFactory;
* *
* @author Simon Kaufmann - Initial contribution * @author Simon Kaufmann - Initial contribution
*/ */
@NonNullByDefault
public class ProfileCallbackImpl implements ProfileCallback { public class ProfileCallbackImpl implements ProfileCallback {
private final Logger logger = LoggerFactory.getLogger(ProfileCallbackImpl.class); private final Logger logger = LoggerFactory.getLogger(ProfileCallbackImpl.class);

View File

@ -18,6 +18,8 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.thing.profiles.ProfileType; import org.openhab.core.thing.profiles.ProfileType;
import org.openhab.core.thing.profiles.ProfileTypeProvider; import org.openhab.core.thing.profiles.ProfileTypeProvider;
import org.openhab.core.thing.profiles.ProfileTypeRegistry; import org.openhab.core.thing.profiles.ProfileTypeRegistry;
@ -32,6 +34,7 @@ import org.osgi.service.component.annotations.ReferencePolicy;
* @author Simon Kaufmann - Initial contribution * @author Simon Kaufmann - Initial contribution
*/ */
@Component(service = ProfileTypeRegistry.class) @Component(service = ProfileTypeRegistry.class)
@NonNullByDefault
public class ProfileTypeRegistryImpl implements ProfileTypeRegistry { public class ProfileTypeRegistryImpl implements ProfileTypeRegistry {
private final List<ProfileTypeProvider> profileTypeProviders = new CopyOnWriteArrayList<>(); private final List<ProfileTypeProvider> profileTypeProviders = new CopyOnWriteArrayList<>();
@ -42,7 +45,7 @@ public class ProfileTypeRegistryImpl implements ProfileTypeRegistry {
} }
@Override @Override
public List<ProfileType> getProfileTypes(Locale locale) { public List<ProfileType> getProfileTypes(@Nullable Locale locale) {
List<ProfileType> profileTypes = new ArrayList<>(); List<ProfileType> profileTypes = new ArrayList<>();
for (ProfileTypeProvider profileTypeProvider : profileTypeProviders) { for (ProfileTypeProvider profileTypeProvider : profileTypeProviders) {
profileTypes.addAll(profileTypeProvider.getProfileTypes(locale)); profileTypes.addAll(profileTypeProvider.getProfileTypes(locale));

View File

@ -21,7 +21,7 @@ import org.openhab.core.thing.profiles.TriggerProfileType;
import org.openhab.core.thing.type.ChannelTypeUID; import org.openhab.core.thing.type.ChannelTypeUID;
/** /**
* Default implementation of a {@link TriggerProfileTypeImpl}. * Default implementation of a {@link TriggerProfileType}.
* *
* @author Simon Kaufmann - Initial contribution * @author Simon Kaufmann - Initial contribution
*/ */
@ -29,9 +29,9 @@ import org.openhab.core.thing.type.ChannelTypeUID;
public class TriggerProfileTypeImpl implements TriggerProfileType { public class TriggerProfileTypeImpl implements TriggerProfileType {
private final ProfileTypeUID profileTypeUID; private final ProfileTypeUID profileTypeUID;
private final Collection<ChannelTypeUID> supportedChannelTypeUIDs;
private final String label; private final String label;
private final Collection<String> supportedItemTypes; private final Collection<String> supportedItemTypes;
private final Collection<ChannelTypeUID> supportedChannelTypeUIDs;
public TriggerProfileTypeImpl(ProfileTypeUID profileTypeUID, String label, Collection<String> supportedItemTypes, public TriggerProfileTypeImpl(ProfileTypeUID profileTypeUID, String label, Collection<String> supportedItemTypes,
Collection<ChannelTypeUID> supportedChannelTypeUIDs) { Collection<ChannelTypeUID> supportedChannelTypeUIDs) {