Skip to content

Commit

Permalink
[denonmarantz] Remove Apache StringUtils (openhab#12526)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
  • Loading branch information
mlobstein authored Mar 27, 2022
1 parent 250efd3 commit 80cb1ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.util.concurrent.ScheduledExecutorService;
import java.util.regex.Pattern;

import org.apache.commons.lang3.StringUtils;
import org.openhab.binding.denonmarantz.internal.DenonMarantzState;
import org.openhab.binding.denonmarantz.internal.config.DenonMarantzConfiguration;
import org.openhab.binding.denonmarantz.internal.connector.DenonMarantzConnector;
Expand Down Expand Up @@ -166,7 +165,7 @@ public void receivedLine(String line) {
state.setSurroundProgram(value);
break;
case "MV": // Main zone volume
if (StringUtils.isNumeric(value)) {
if (value.chars().allMatch(Character::isDigit)) {
state.setMainVolume(fromDenonValue(value));
}
break;
Expand All @@ -183,7 +182,7 @@ public void receivedLine(String line) {
state.setZone2Power(value.equals("ON"));
} else if (value.equals("MUON") || value.equals("MUOFF")) {
state.setZone2Mute(value.equals("MUON"));
} else if (StringUtils.isNumeric(value)) {
} else if (value.chars().allMatch(Character::isDigit)) {
state.setZone2Volume(fromDenonValue(value));
} else {
state.setZone2Input(value);
Expand All @@ -194,7 +193,7 @@ public void receivedLine(String line) {
state.setZone3Power(value.equals("ON"));
} else if (value.equals("MUON") || value.equals("MUOFF")) {
state.setZone3Mute(value.equals("MUON"));
} else if (StringUtils.isNumeric(value)) {
} else if (value.chars().allMatch(Character::isDigit)) {
state.setZone3Volume(fromDenonValue(value));
} else {
state.setZone3Input(value);
Expand All @@ -205,7 +204,7 @@ public void receivedLine(String line) {
state.setZone4Power(value.equals("ON"));
} else if (value.equals("MUON") || value.equals("MUOFF")) {
state.setZone4Mute(value.equals("MUON"));
} else if (StringUtils.isNumeric(value)) {
} else if (value.chars().allMatch(Character::isDigit)) {
state.setZone4Volume(fromDenonValue(value));
} else {
state.setZone4Input(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

import javax.xml.bind.annotation.adapters.XmlAdapter;

import org.apache.commons.lang3.StringUtils;

/**
* Adapter to clean up string values
*
Expand All @@ -27,7 +25,7 @@ public class StringAdapter extends XmlAdapter<String, String> {
public String unmarshal(String v) throws Exception {
String val = v;
if (val != null) {
val = StringUtils.trimToEmpty(val);
return val.trim();
}
return val;
}
Expand Down

0 comments on commit 80cb1ed

Please sign in to comment.