aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/web/JsonConverter.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-12-01 15:15:05 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-12-01 15:15:05 +1300
commit4ed22fb839fab2f19a6220bb8540317521209c4a (patch)
tree7c2ccf986ab9396900bc4e764f89a5be42082060 /src/org/traccar/web/JsonConverter.java
parent77b9194cc963645fc9ccf7ce79280982cead8f0f (diff)
downloadtrackermap-server-4ed22fb839fab2f19a6220bb8540317521209c4a.tar.gz
trackermap-server-4ed22fb839fab2f19a6220bb8540317521209c4a.tar.bz2
trackermap-server-4ed22fb839fab2f19a6220bb8540317521209c4a.zip
Remove Clazz utility class
Diffstat (limited to 'src/org/traccar/web/JsonConverter.java')
-rw-r--r--src/org/traccar/web/JsonConverter.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/org/traccar/web/JsonConverter.java b/src/org/traccar/web/JsonConverter.java
index 38721db61..2ef61fb13 100644
--- a/src/org/traccar/web/JsonConverter.java
+++ b/src/org/traccar/web/JsonConverter.java
@@ -34,7 +34,6 @@ import javax.json.JsonValue;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;
-import org.traccar.helper.Clazz;
import org.traccar.helper.Log;
import org.traccar.model.Factory;
import org.traccar.model.MiscFormatter;
@@ -44,6 +43,14 @@ public final class JsonConverter {
private JsonConverter() {
}
+ private static <T> T newClassInstance(Class<T> clazz) {
+ try {
+ return clazz.newInstance();
+ } catch (InstantiationException | IllegalAccessException e) {
+ throw new IllegalArgumentException();
+ }
+ }
+
private static final DateTimeFormatter DATE_FORMAT = ISODateTimeFormat.dateTime();
public static Date parseDate(String value) {
@@ -69,7 +76,7 @@ public final class JsonConverter {
}
public static <T> T objectFromJson(JsonObject json, Class<T> clazz) {
- T object = Clazz.newInstance(clazz);
+ T object = newClassInstance(clazz);
Method[] methods = object.getClass().getMethods();
return objectFromJson(json, object, methods);
}