Skip to content

Commit

Permalink
refactor: Fix 'dtfm' vs 'dtmf' typo
Browse files Browse the repository at this point in the history
  • Loading branch information
JPPortier committed Feb 22, 2024
1 parent e97a4d7 commit 7bd30b3
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions client/src/main/com/sinch/sdk/models/DualToneMultiFrequency.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@ public class DualToneMultiFrequency {
private static final Logger LOGGER = Logger.getLogger(DualToneMultiFrequency.class.getName());
private static final Pattern PATTERN = Pattern.compile("([0-9#w])*");
private static final AtomicBoolean STRICT = new AtomicBoolean(true);
private final String dtfm;
private final String dtmf;

/**
* Create an instance of DualToneMultiFrequency
*
* @param dtfm The dtfm value. Valid characters in the string are "0"-"9", "#" and "w"
* @param dtmf The dtmf value. Valid characters in the string are "0"-"9", "#" and "w"
* @throws IllegalArgumentException Throw an exception if value contains invalid characters
*/
public DualToneMultiFrequency(String dtfm) throws IllegalArgumentException {
public DualToneMultiFrequency(String dtmf) throws IllegalArgumentException {

if (!validate(dtfm)) {
String message = String.format("Invalid DTFM format for '%s' number", dtfm);
if (!validate(dtmf)) {
String message = String.format("Invalid DTMF format: '%s'", dtmf);

if (STRICT.get()) {
throw new IllegalArgumentException(message);
}
LOGGER.warning(message);
}
this.dtfm = dtfm;
this.dtmf = dtmf;
}

/**
Expand All @@ -62,7 +62,7 @@ public static void setStrict(boolean strict) {
}

/**
* Validate string against authorized values for DTFM value
* Validate string against authorized values for DTMF value
*
* @param value The value to be validated
* @return Is string valid or not
Expand All @@ -72,17 +72,17 @@ public static boolean validate(String value) {
}

/**
* Get the DTFM value
* Get the DTMF value
*
* @return The dtfm value
* @return The dtmf value
*/
public String stringValue() {
return dtfm;
return dtmf;
}

@Override
public String toString() {
return "DualToneMultiFrequency{" + "dtfm='" + dtfm + '\'' + '}';
return "DualToneMultiFrequency{" + "dtmf='" + dtmf + '\'' + '}';
}

@Override
Expand All @@ -94,11 +94,11 @@ public boolean equals(Object o) {
return false;
}
DualToneMultiFrequency that = (DualToneMultiFrequency) o;
return Objects.equals(dtfm, that.dtfm);
return Objects.equals(dtmf, that.dtmf);
}

@Override
public int hashCode() {
return Objects.hash(dtfm);
return Objects.hash(dtmf);
}
}

0 comments on commit 7bd30b3

Please sign in to comment.