|
@ -1,8 +1,11 @@ |
|
|
package hs.fulda.de.ci.exam.project; |
|
|
package hs.fulda.de.ci.exam.project; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
|
|
|
|
public class SmsNotification extends Notification { |
|
|
public class SmsNotification extends Notification { |
|
|
String to; |
|
|
String to; |
|
|
String content; |
|
|
String content; |
|
|
|
|
|
|
|
|
public SmsNotification(String to, String content) { |
|
|
public SmsNotification(String to, String content) { |
|
|
super(); |
|
|
super(); |
|
|
this.to = to; |
|
|
this.to = to; |
|
@ -20,6 +23,15 @@ public class SmsNotification extends Notification { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private boolean isValidEmail(String to) { |
|
|
private boolean isValidEmail(String to) { |
|
|
return true; |
|
|
|
|
|
|
|
|
String regexPattern = "(\\(?([\\d \\-\\)\\–\\+\\/\\(]+){6,}\\)?([ .\\-–\\/]?)([\\d]+))"; |
|
|
|
|
|
return patternMatches(to, regexPattern); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static boolean patternMatches(String emailAddress, String regexPattern) { |
|
|
|
|
|
return Pattern.compile(regexPattern) |
|
|
|
|
|
.matcher(emailAddress) |
|
|
|
|
|
.matches(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |