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:
@@ -53,9 +53,7 @@ public class BoseSoundTouchHandlerFactory extends BaseThingHandlerFactory {
|
||||
ContentItem.class.getClassLoader());
|
||||
BoseStateDescriptionOptionProvider localDescriptionOptionProvider = stateOptionProvider;
|
||||
if (localDescriptionOptionProvider != null) {
|
||||
BoseSoundTouchHandler handler = new BoseSoundTouchHandler(thing, new PresetContainer(storage),
|
||||
localDescriptionOptionProvider);
|
||||
return handler;
|
||||
return new BoseSoundTouchHandler(thing, new PresetContainer(storage), localDescriptionOptionProvider);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -79,8 +79,7 @@ public class ContentItem {
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj instanceof ContentItem) {
|
||||
ContentItem other = (ContentItem) obj;
|
||||
if (obj instanceof ContentItem other) {
|
||||
return Objects.equals(other.source, this.source) || Objects.equals(other.sourceAccount, this.sourceAccount)
|
||||
|| other.presetable == this.presetable || Objects.equals(other.location, this.location)
|
||||
|| Objects.equals(other.itemName, this.itemName);
|
||||
@@ -188,11 +187,11 @@ public class ContentItem {
|
||||
* ' - '
|
||||
*/
|
||||
private String escapeXml(String xml) {
|
||||
xml = xml.replaceAll("&", "&");
|
||||
xml = xml.replaceAll("<", "<");
|
||||
xml = xml.replaceAll(">", ">");
|
||||
xml = xml.replaceAll("\"", """);
|
||||
xml = xml.replaceAll("'", "'");
|
||||
xml = xml.replace("&", "&");
|
||||
xml = xml.replace("<", "<");
|
||||
xml = xml.replace(">", ">");
|
||||
xml = xml.replace("\"", """);
|
||||
xml = xml.replace("'", "'");
|
||||
return xml;
|
||||
}
|
||||
|
||||
@@ -251,7 +250,7 @@ public class ContentItem {
|
||||
}
|
||||
|
||||
public StateOption toStateOption() {
|
||||
String stateOptionLabel = String.valueOf(presetID) + ": " + itemName;
|
||||
String stateOptionLabel = presetID + ": " + itemName;
|
||||
return new StateOption(String.valueOf(presetID), stateOptionLabel);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user