aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper/Clazz.java
diff options
context:
space:
mode:
authorRafael Guterres <guterresrafael@gmail.com>2015-11-27 03:32:59 -0200
committerRafael Guterres <guterresrafael@gmail.com>2015-11-27 03:32:59 -0200
commitc57bd2d472467b1b3a45aee1b97c9a0aeef5958a (patch)
tree26fae20adf1970b5834f06393a3c703c972f39b1 /src/org/traccar/helper/Clazz.java
parent77cd23da84ebebcf99a97a8aef88aa9a4884ca40 (diff)
downloadtrackermap-server-c57bd2d472467b1b3a45aee1b97c9a0aeef5958a.tar.gz
trackermap-server-c57bd2d472467b1b3a45aee1b97c9a0aeef5958a.tar.bz2
trackermap-server-c57bd2d472467b1b3a45aee1b97c9a0aeef5958a.zip
Initial implementation of new api with jax-rs.
Revert servlets to old api and remove plurals. Fix findbugs for header origin.
Diffstat (limited to 'src/org/traccar/helper/Clazz.java')
-rw-r--r--src/org/traccar/helper/Clazz.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/org/traccar/helper/Clazz.java b/src/org/traccar/helper/Clazz.java
index bdde940a0..ba4c4fded 100644
--- a/src/org/traccar/helper/Clazz.java
+++ b/src/org/traccar/helper/Clazz.java
@@ -16,11 +16,14 @@
package org.traccar.helper;
import java.beans.Introspector;
+import java.io.Serializable;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
-public final class Clazz {
+public final class Clazz implements Serializable {
+
+ private static final long serialVersionUID = 4983299355055144885L;
private Clazz() {
}
@@ -77,7 +80,7 @@ public final class Clazz {
}
}
- public static long getId(Object entity) throws Exception {
+ public static <T> long getId(T entity) throws Exception {
Method[] methods = entity.getClass().getMethods();
for (final Method method : methods) {
if (method.getName().startsWith("get") && method.getParameterTypes().length == 0) {
@@ -90,7 +93,7 @@ public final class Clazz {
throw new IllegalArgumentException();
}
- public static void setId(Object entity, long id) throws Exception {
+ public static <T, I> void setId(T entity, I id) throws Exception {
Method[] methods = entity.getClass().getMethods();
for (final Method method : methods) {
if (method.getName().startsWith("set") && method.getParameterTypes().length == 1) {