aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/equalparts/cardbase/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/equalparts/cardbase/utils')
-rw-r--r--src/eu/equalparts/cardbase/utils/InputSanity.java27
-rw-r--r--src/eu/equalparts/cardbase/utils/Utils.java15
2 files changed, 15 insertions, 27 deletions
diff --git a/src/eu/equalparts/cardbase/utils/InputSanity.java b/src/eu/equalparts/cardbase/utils/InputSanity.java
deleted file mode 100644
index 0571c73..0000000
--- a/src/eu/equalparts/cardbase/utils/InputSanity.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package eu.equalparts.cardbase.utils;
-
-public class InputSanity {
- public static boolean isInteger(String str) {
- if (str == null) {
- return false;
- }
- int length = str.length();
- if (length == 0) {
- return false;
- }
- int i = 0;
- if (str.charAt(0) == '-') {
- if (length == 1) {
- return false;
- }
- i = 1;
- }
- for (; i < length; i++) {
- char c = str.charAt(i);
- if (c < '0' || c > '9') {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/src/eu/equalparts/cardbase/utils/Utils.java b/src/eu/equalparts/cardbase/utils/Utils.java
new file mode 100644
index 0000000..bb88397
--- /dev/null
+++ b/src/eu/equalparts/cardbase/utils/Utils.java
@@ -0,0 +1,15 @@
+package eu.equalparts.cardbase.utils;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+
+public class Utils {
+ public static boolean hasAnnotation(Field fieldToAnalyse, Class<? extends Annotation> annotation) {
+ for (Annotation a : fieldToAnalyse.getAnnotations()) {
+ if (a.annotationType().equals(annotation)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}