diff --git a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/config/BlindConfig.java b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/config/BlindConfig.java index 71ebcc45a33c8..5cc4013e334fb 100644 --- a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/config/BlindConfig.java +++ b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/config/BlindConfig.java @@ -12,12 +12,16 @@ */ package org.openhab.binding.lutron.internal.config; +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; + /** * Configuration settings for an {@link org.openhab.binding.lutron.internal.handler.BlindHandler}. * * @author Bob Adair - Initial contribution */ +@NonNullByDefault public class BlindConfig { public int integrationId = 0; - public String type; + public @Nullable String type; } diff --git a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/config/DimmerConfig.java b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/config/DimmerConfig.java index 998ea1c006c38..219095aa4357c 100644 --- a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/config/DimmerConfig.java +++ b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/config/DimmerConfig.java @@ -14,39 +14,18 @@ import java.math.BigDecimal; +import org.eclipse.jdt.annotation.NonNullByDefault; + /** * Configuration settings for a {@link org.openhab.binding.lutron.internal.handler.DimmerHandler}. * * @author Allan Tong - Initial contribution */ +@NonNullByDefault public class DimmerConfig { private static final int DEFAULT_FADE = 1; - private int integrationId; - private BigDecimal fadeInTime = new BigDecimal(DEFAULT_FADE); - private BigDecimal fadeOutTime = new BigDecimal(DEFAULT_FADE); - - public int getIntegrationId() { - return this.integrationId; - } - - public void setIntegrationId(int integrationId) { - this.integrationId = integrationId; - } - - public BigDecimal getFadeInTime() { - return this.fadeInTime; - } - - public void setFadeInTime(BigDecimal fadeInTime) { - this.fadeInTime = fadeInTime; - } - - public BigDecimal getFadeOutTime() { - return this.fadeOutTime; - } - - public void setFadeOutTime(BigDecimal fadeOutTime) { - this.fadeOutTime = fadeOutTime; - } + public int integrationId; + public BigDecimal fadeInTime = new BigDecimal(DEFAULT_FADE); + public BigDecimal fadeOutTime = new BigDecimal(DEFAULT_FADE); } diff --git a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/DimmerHandler.java b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/DimmerHandler.java index 3af58f922b10d..37cfd3ead29f9 100644 --- a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/DimmerHandler.java +++ b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/DimmerHandler.java @@ -48,17 +48,17 @@ public DimmerHandler(Thing thing) { @Override public int getIntegrationId() { - if (this.config == null) { + if (config == null) { throw new IllegalStateException("handler not initialized"); } - return this.config.getIntegrationId(); + return config.integrationId; } @Override public void initialize() { config = getThing().getConfiguration().as(DimmerConfig.class); - if (config.getIntegrationId() <= 0) { + if (config.integrationId <= 0) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "No integrationId configured"); return; } @@ -97,9 +97,9 @@ public void handleCommand(ChannelUID channelUID, Command command) { output(ACTION_ZONELEVEL, level, 0.25); } else if (command.equals(OnOffType.ON)) { - output(ACTION_ZONELEVEL, 100, this.config.getFadeInTime()); + output(ACTION_ZONELEVEL, 100, this.config.fadeInTime); } else if (command.equals(OnOffType.OFF)) { - output(ACTION_ZONELEVEL, 0, this.config.getFadeOutTime()); + output(ACTION_ZONELEVEL, 0, this.config.fadeOutTime); } } } diff --git a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/VcrxHandler.java b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/VcrxHandler.java index dadc4b29a5710..62a47978bd675 100644 --- a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/VcrxHandler.java +++ b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/VcrxHandler.java @@ -84,13 +84,13 @@ public ComponentType type() { } } - private static final List BUTTONGROUP = Arrays.asList(Component.BUTTON1, Component.BUTTON2, + private static final List BUTTON_GROUP = Arrays.asList(Component.BUTTON1, Component.BUTTON2, Component.BUTTON3, Component.BUTTON4, Component.BUTTON5, Component.BUTTON6); - private static final List LEDGROUP = Arrays.asList(Component.LED1, Component.LED2, Component.LED3, + private static final List LED_GROUP = Arrays.asList(Component.LED1, Component.LED2, Component.LED3, Component.LED4, Component.LED5, Component.LED6); - private static final List CCIGROUP = Arrays.asList(Component.CCI1, Component.CCI2, Component.CCI3, + private static final List CCI_GROUP = Arrays.asList(Component.CCI1, Component.CCI2, Component.CCI3, Component.CCI4); private final Logger logger = LoggerFactory.getLogger(VcrxHandler.class); @@ -114,9 +114,9 @@ protected boolean isCCI(int id) { protected void configureComponents(@Nullable String model) { logger.debug("Configuring components for VCRX"); - buttonList.addAll(BUTTONGROUP); - ledList.addAll(LEDGROUP); - cciList.addAll(CCIGROUP); + buttonList.addAll(BUTTON_GROUP); + ledList.addAll(LED_GROUP); + cciList.addAll(CCI_GROUP); } public VcrxHandler(Thing thing) { diff --git a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/keypadconfig/KeypadConfigTabletopSeetouch.java b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/keypadconfig/KeypadConfigTabletopSeetouch.java index 52538331fda97..5e906d0443599 100644 --- a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/keypadconfig/KeypadConfigTabletopSeetouch.java +++ b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/keypadconfig/KeypadConfigTabletopSeetouch.java @@ -106,29 +106,29 @@ public ComponentType type() { } } - private static final List BUTTONGROUP1 = Arrays.asList(Component.BUTTON1, Component.BUTTON2, + private static final List BUTTON_GROUP1 = Arrays.asList(Component.BUTTON1, Component.BUTTON2, Component.BUTTON3, Component.BUTTON4, Component.BUTTON5); - private static final List BUTTONGROUP2 = Arrays.asList(Component.BUTTON6, Component.BUTTON7, + private static final List BUTTON_GROUP2 = Arrays.asList(Component.BUTTON6, Component.BUTTON7, Component.BUTTON8, Component.BUTTON9, Component.BUTTON10); - private static final List BUTTONGROUP3 = Arrays.asList(Component.BUTTON11, Component.BUTTON12, + private static final List BUTTON_GROUP3 = Arrays.asList(Component.BUTTON11, Component.BUTTON12, Component.BUTTON13, Component.BUTTON14, Component.BUTTON15); - private static final List BUTTONGROUPBOTTOM_RL = Arrays.asList(Component.BUTTON16, + private static final List BUTTON_GROUPBOTTOM_RL = Arrays.asList(Component.BUTTON16, Component.BUTTON17, Component.LOWER3, Component.RAISE3); - private static final List BUTTONGROUPBOTTOM_CRL = Arrays.asList(Component.LOWER1, Component.RAISE1, + private static final List BUTTON_GROUPBOTTOM_CRL = Arrays.asList(Component.LOWER1, Component.RAISE1, Component.LOWER2, Component.RAISE2, Component.LOWER3, Component.RAISE3); - private static final List BUTTONGROUPBOTTOM_GENERIC = Arrays.asList(Component.BUTTON16, + private static final List BUTTON_GROUPBOTTOM_GENERIC = Arrays.asList(Component.BUTTON16, Component.BUTTON17, Component.LOWER1, Component.RAISE1, Component.LOWER2, Component.RAISE2, Component.LOWER3, Component.RAISE3); - private static final List LEDGROUP1 = Arrays.asList(Component.LED1, Component.LED2, Component.LED3, + private static final List LED_GROUP1 = Arrays.asList(Component.LED1, Component.LED2, Component.LED3, Component.LED4, Component.LED5); - private static final List LEDGROUP2 = Arrays.asList(Component.LED6, Component.LED7, Component.LED8, + private static final List LED_GROUP2 = Arrays.asList(Component.LED6, Component.LED7, Component.LED8, Component.LED9, Component.LED10); - private static final List LEDGROUP3 = Arrays.asList(Component.LED11, Component.LED12, + private static final List LED_GROUP3 = Arrays.asList(Component.LED11, Component.LED12, Component.LED13, Component.LED14, Component.LED15); - private static final List LEDGROUPBOTTOM_RL = Arrays.asList(Component.LED16, Component.LED17); + private static final List LED_GROUPBOTTOM_RL = Arrays.asList(Component.LED16, Component.LED17); @Override public boolean isLed(int id) { @@ -146,22 +146,22 @@ public boolean isCCI(int id) { } public KeypadConfigTabletopSeetouch() { - modelData.put("T5RL", combinedList(BUTTONGROUP1, BUTTONGROUPBOTTOM_RL, LEDGROUP1, LEDGROUPBOTTOM_RL)); + modelData.put("T5RL", combinedList(BUTTON_GROUP1, BUTTON_GROUPBOTTOM_RL, LED_GROUP1, LED_GROUPBOTTOM_RL)); - modelData.put("T10RL", combinedList(BUTTONGROUP1, BUTTONGROUP2, BUTTONGROUPBOTTOM_RL, LEDGROUP1, LEDGROUP2, - LEDGROUPBOTTOM_RL)); + modelData.put("T10RL", combinedList(BUTTON_GROUP1, BUTTON_GROUP2, BUTTON_GROUPBOTTOM_RL, LED_GROUP1, LED_GROUP2, + LED_GROUPBOTTOM_RL)); - modelData.put("T15RL", combinedList(BUTTONGROUP1, BUTTONGROUP2, BUTTONGROUP3, BUTTONGROUPBOTTOM_RL, LEDGROUP1, - LEDGROUP2, LEDGROUP3, LEDGROUPBOTTOM_RL)); + modelData.put("T15RL", combinedList(BUTTON_GROUP1, BUTTON_GROUP2, BUTTON_GROUP3, BUTTON_GROUPBOTTOM_RL, LED_GROUP1, + LED_GROUP2, LED_GROUP3, LED_GROUPBOTTOM_RL)); - modelData.put("T5CRL", combinedList(BUTTONGROUP1, BUTTONGROUPBOTTOM_CRL, LEDGROUP1)); + modelData.put("T5CRL", combinedList(BUTTON_GROUP1, BUTTON_GROUPBOTTOM_CRL, LED_GROUP1)); - modelData.put("T10CRL", combinedList(BUTTONGROUP1, BUTTONGROUP2, BUTTONGROUPBOTTOM_CRL, LEDGROUP1, LEDGROUP2)); + modelData.put("T10CRL", combinedList(BUTTON_GROUP1, BUTTON_GROUP2, BUTTON_GROUPBOTTOM_CRL, LED_GROUP1, LED_GROUP2)); - modelData.put("T15CRL", combinedList(BUTTONGROUP1, BUTTONGROUP2, BUTTONGROUP3, BUTTONGROUPBOTTOM_CRL, LEDGROUP1, - LEDGROUP2, LEDGROUP3)); + modelData.put("T15CRL", combinedList(BUTTON_GROUP1, BUTTON_GROUP2, BUTTON_GROUP3, BUTTON_GROUPBOTTOM_CRL, LED_GROUP1, + LED_GROUP2, LED_GROUP3)); - modelData.put("Generic", combinedList(BUTTONGROUP1, BUTTONGROUP2, BUTTONGROUP3, BUTTONGROUPBOTTOM_GENERIC, - LEDGROUP1, LEDGROUP2, LEDGROUP3, LEDGROUPBOTTOM_RL)); // Superset of all models + modelData.put("Generic", combinedList(BUTTON_GROUP1, BUTTON_GROUP2, BUTTON_GROUP3, BUTTON_GROUPBOTTOM_GENERIC, + LED_GROUP1, LED_GROUP2, LED_GROUP3, LED_GROUPBOTTOM_RL)); // Superset of all models } } diff --git a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/xml/DbXmlInfoReader.java b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/xml/DbXmlInfoReader.java index 3b0b7222bd139..0a3659ef0ca80 100644 --- a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/xml/DbXmlInfoReader.java +++ b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/xml/DbXmlInfoReader.java @@ -16,6 +16,8 @@ import java.io.Reader; import java.net.URL; +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.lutron.internal.discovery.project.Area; import org.openhab.binding.lutron.internal.discovery.project.Component; import org.openhab.binding.lutron.internal.discovery.project.Device; @@ -37,6 +39,7 @@ * @author Bob Adair - Added support for reading XML from a file. Requires using XStream directly * instead of XmlDocumentReader. */ +@NonNullByDefault public class DbXmlInfoReader { private final XStream xstream; @@ -115,7 +118,7 @@ public void registerAliases(XStream xstream) { xstream.ignoreUnknownElements(); } - public Project readFromXML(URL xmlURL) throws ConversionException { + public @Nullable Project readFromXML(@Nullable URL xmlURL) throws ConversionException { if (xmlURL != null) { return (Project) xstream.fromXML(xmlURL); } @@ -123,7 +126,7 @@ public Project readFromXML(URL xmlURL) throws ConversionException { return null; } - public Project readFromXML(File xmlFile) throws ConversionException { + public @Nullable Project readFromXML(@Nullable File xmlFile) throws ConversionException { if (xmlFile != null) { return (Project) xstream.fromXML(xmlFile); } @@ -131,7 +134,7 @@ public Project readFromXML(File xmlFile) throws ConversionException { return null; } - public Project readFromXML(Reader xmlReader) throws ConversionException { + public @Nullable Project readFromXML(@Nullable Reader xmlReader) throws ConversionException { if (xmlReader != null) { return (Project) xstream.fromXML(xmlReader); } @@ -139,7 +142,7 @@ public Project readFromXML(Reader xmlReader) throws ConversionException { return null; } - public Project readFromXML(String xmlString) throws ConversionException { + public @Nullable Project readFromXML(@Nullable String xmlString) throws ConversionException { if (xmlString != null) { return (Project) xstream.fromXML(xmlString); }