-package org.simantics.utils.strings;\r
-\r
-import java.util.Collection;\r
-import java.util.Collections;\r
-import java.util.regex.Pattern;\r
-\r
-public class ValidatorUtils {\r
-\r
- public static Pattern alphaNumericPattern(int length) {\r
-\r
- String pattern = "^(_|\\p{Alnum}){1," + length + "}+$";\r
- return Pattern.compile(pattern);\r
- \r
- }\r
- \r
- public static Collection<StringInputProblem> errorProblem(final String text) {\r
- return Collections.<StringInputProblem>singletonList(new StringInputProblem() {\r
- \r
- @Override\r
- public Severity getSeverity() {\r
- return Severity.Error;\r
- }\r
- \r
- @Override\r
- public int getEnd() {\r
- return 0;\r
- }\r
- \r
- @Override\r
- public String getDescription() {\r
- return text;\r
- }\r
- \r
- @Override\r
- public int getBegin() {\r
- return 0;\r
- }\r
- \r
- });\r
- }\r
- \r
-}\r
+package org.simantics.utils.strings;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.regex.Pattern;
+
+public class ValidatorUtils {
+
+ public static Pattern alphaNumericPattern(int length) {
+
+ String pattern = "^(_|\\p{Alnum}){1," + length + "}+$";
+ return Pattern.compile(pattern);
+
+ }
+
+ public static Collection<StringInputProblem> errorProblem(final String text) {
+ return Collections.<StringInputProblem>singletonList(new StringInputProblem() {
+
+ @Override
+ public Severity getSeverity() {
+ return Severity.Error;
+ }
+
+ @Override
+ public int getEnd() {
+ return 0;
+ }
+
+ @Override
+ public String getDescription() {
+ return text;
+ }
+
+ @Override
+ public int getBegin() {
+ return 0;
+ }
+
+ });
+ }
+
+}