[denonmarantz] Remove Apache StringUtils (#12526)
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
This commit is contained in:
parent
250efd3c0b
commit
80cb1ed251
|
@ -20,7 +20,6 @@ import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.openhab.binding.denonmarantz.internal.DenonMarantzState;
|
import org.openhab.binding.denonmarantz.internal.DenonMarantzState;
|
||||||
import org.openhab.binding.denonmarantz.internal.config.DenonMarantzConfiguration;
|
import org.openhab.binding.denonmarantz.internal.config.DenonMarantzConfiguration;
|
||||||
import org.openhab.binding.denonmarantz.internal.connector.DenonMarantzConnector;
|
import org.openhab.binding.denonmarantz.internal.connector.DenonMarantzConnector;
|
||||||
|
@ -166,7 +165,7 @@ public class DenonMarantzTelnetConnector extends DenonMarantzConnector implement
|
||||||
state.setSurroundProgram(value);
|
state.setSurroundProgram(value);
|
||||||
break;
|
break;
|
||||||
case "MV": // Main zone volume
|
case "MV": // Main zone volume
|
||||||
if (StringUtils.isNumeric(value)) {
|
if (value.chars().allMatch(Character::isDigit)) {
|
||||||
state.setMainVolume(fromDenonValue(value));
|
state.setMainVolume(fromDenonValue(value));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -183,7 +182,7 @@ public class DenonMarantzTelnetConnector extends DenonMarantzConnector implement
|
||||||
state.setZone2Power(value.equals("ON"));
|
state.setZone2Power(value.equals("ON"));
|
||||||
} else if (value.equals("MUON") || value.equals("MUOFF")) {
|
} else if (value.equals("MUON") || value.equals("MUOFF")) {
|
||||||
state.setZone2Mute(value.equals("MUON"));
|
state.setZone2Mute(value.equals("MUON"));
|
||||||
} else if (StringUtils.isNumeric(value)) {
|
} else if (value.chars().allMatch(Character::isDigit)) {
|
||||||
state.setZone2Volume(fromDenonValue(value));
|
state.setZone2Volume(fromDenonValue(value));
|
||||||
} else {
|
} else {
|
||||||
state.setZone2Input(value);
|
state.setZone2Input(value);
|
||||||
|
@ -194,7 +193,7 @@ public class DenonMarantzTelnetConnector extends DenonMarantzConnector implement
|
||||||
state.setZone3Power(value.equals("ON"));
|
state.setZone3Power(value.equals("ON"));
|
||||||
} else if (value.equals("MUON") || value.equals("MUOFF")) {
|
} else if (value.equals("MUON") || value.equals("MUOFF")) {
|
||||||
state.setZone3Mute(value.equals("MUON"));
|
state.setZone3Mute(value.equals("MUON"));
|
||||||
} else if (StringUtils.isNumeric(value)) {
|
} else if (value.chars().allMatch(Character::isDigit)) {
|
||||||
state.setZone3Volume(fromDenonValue(value));
|
state.setZone3Volume(fromDenonValue(value));
|
||||||
} else {
|
} else {
|
||||||
state.setZone3Input(value);
|
state.setZone3Input(value);
|
||||||
|
@ -205,7 +204,7 @@ public class DenonMarantzTelnetConnector extends DenonMarantzConnector implement
|
||||||
state.setZone4Power(value.equals("ON"));
|
state.setZone4Power(value.equals("ON"));
|
||||||
} else if (value.equals("MUON") || value.equals("MUOFF")) {
|
} else if (value.equals("MUON") || value.equals("MUOFF")) {
|
||||||
state.setZone4Mute(value.equals("MUON"));
|
state.setZone4Mute(value.equals("MUON"));
|
||||||
} else if (StringUtils.isNumeric(value)) {
|
} else if (value.chars().allMatch(Character::isDigit)) {
|
||||||
state.setZone4Volume(fromDenonValue(value));
|
state.setZone4Volume(fromDenonValue(value));
|
||||||
} else {
|
} else {
|
||||||
state.setZone4Input(value);
|
state.setZone4Input(value);
|
||||||
|
|
|
@ -14,8 +14,6 @@ package org.openhab.binding.denonmarantz.internal.xml.adapters;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapter to clean up string values
|
* Adapter to clean up string values
|
||||||
*
|
*
|
||||||
|
@ -27,7 +25,7 @@ public class StringAdapter extends XmlAdapter<String, String> {
|
||||||
public String unmarshal(String v) throws Exception {
|
public String unmarshal(String v) throws Exception {
|
||||||
String val = v;
|
String val = v;
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
val = StringUtils.trimToEmpty(val);
|
return val.trim();
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue