Java 17 features (A-G) (#15516)
- 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 Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
@@ -54,7 +54,7 @@ public class CommandGetserial extends AbstractCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
String fields[] = deviceReply.split(",");
|
||||
String[] fields = deviceReply.split(",");
|
||||
if (fields.length != 5) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class CommandSendir extends AbstractCommand {
|
||||
super(thing, queue, "sendir", CommandType.COMMAND);
|
||||
|
||||
this.command = command;
|
||||
deviceCommand = "sendir," + mod + ":" + con + "," + String.valueOf(sendCounter) + "," + code;
|
||||
deviceCommand = "sendir," + mod + ":" + con + "," + sendCounter + "," + code;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,7 +34,7 @@ public class CommandSendserial extends AbstractCommand {
|
||||
String con, String code) {
|
||||
super(thing, queue, "sendserial", CommandType.SERIAL1);
|
||||
// Check to see if this is for the second serial port on a GC-100-12
|
||||
if (isGC100Model12() && mod.equals("2")) {
|
||||
if (isGC100Model12() && "2".equals(mod)) {
|
||||
setCommandType(CommandType.SERIAL2);
|
||||
}
|
||||
this.command = command;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class CommandSetserial extends AbstractCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
String fields[] = deviceReply.split(",");
|
||||
String[] fields = deviceReply.split(",");
|
||||
if (fields.length != 5) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class CommandSetstate extends AbstractCommand {
|
||||
if (m.groupCount() == 4) {
|
||||
setModule(m.group(2));
|
||||
setConnector(m.group(3));
|
||||
setState(m.group(4).equals("0") ? OnOffType.OFF : OnOffType.ON);
|
||||
setState("0".equals(m.group(4)) ? OnOffType.OFF : OnOffType.ON);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ public class GlobalCacheHandler extends BaseThingHandler {
|
||||
throw new HexCodeConversionException("Hex code is too short");
|
||||
}
|
||||
|
||||
if (!hexCodeArray[0].equals("0000")) {
|
||||
if (!"0000".equals(hexCodeArray[0])) {
|
||||
throw new HexCodeConversionException("Illegal hex code element 0, should be 0000");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user