diff options
Diffstat (limited to 'src/org/traccar/helper/Clazz.java')
-rw-r--r-- | src/org/traccar/helper/Clazz.java | 9 |
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) { |