Java 17 features (H-M) (#15520)
- add missing @override - Java style array syntax - remove redundant modifiers - always move String constants to left side in comparisons - simplify lambda expressions and return statements - use replace instead of replaceAll w/o regex - instanceof matching and multiline strings - remove null check before instanceof Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
@@ -19,7 +19,6 @@ import static org.openhab.core.library.unit.SIUnits.*;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
import java.util.TooManyListenersException;
|
||||
@@ -54,7 +53,7 @@ import org.slf4j.LoggerFactory;
|
||||
* @author Chris Jackson - Initial contribution
|
||||
*/
|
||||
public class MeteostickBridgeHandler extends BaseBridgeHandler {
|
||||
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = Collections.singleton(THING_TYPE_BRIDGE);
|
||||
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = Set.of(THING_TYPE_BRIDGE);
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(MeteostickBridgeHandler.class);
|
||||
|
||||
@@ -256,7 +255,7 @@ public class MeteostickBridgeHandler extends BaseBridgeHandler {
|
||||
if (rxByte == 13 && rxCnt > 0) {
|
||||
String inputString = new String(rxPacket, 0, rxCnt);
|
||||
logger.debug("MeteoStick received: {}", inputString);
|
||||
String p[] = inputString.split("\\s+");
|
||||
String[] p = inputString.split("\\s+");
|
||||
|
||||
switch (p[0]) {
|
||||
case "B": // Barometer
|
||||
|
||||
@@ -24,5 +24,5 @@ public interface MeteostickEventListener {
|
||||
*
|
||||
* @param data a line of data from the meteoStick
|
||||
*/
|
||||
void onDataReceived(String data[]);
|
||||
void onDataReceived(String[] data);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory;
|
||||
* @author John Cocula - Added variable spoon size, UoM, wind stats, bug fixes
|
||||
*/
|
||||
public class MeteostickSensorHandler extends BaseThingHandler implements MeteostickEventListener {
|
||||
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = Collections.singleton(THING_TYPE_DAVIS);
|
||||
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = Set.of(THING_TYPE_DAVIS);
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(MeteostickSensorHandler.class);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user