From 886eb61ff0961d7e3be4e926d1510994b3df84e2 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 21 Feb 2017 23:46:36 +1300 Subject: Ignore marked methods in query builder (fix #2941) --- src/org/traccar/database/QueryBuilder.java | 7 +++++-- src/org/traccar/model/Geofence.java | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/database/QueryBuilder.java b/src/org/traccar/database/QueryBuilder.java index 9972bb74d..83bc5de2e 100644 --- a/src/org/traccar/database/QueryBuilder.java +++ b/src/org/traccar/database/QueryBuilder.java @@ -15,6 +15,7 @@ */ package org.traccar.database; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.core.JsonProcessingException; import org.traccar.Context; import org.traccar.helper.Log; @@ -260,7 +261,8 @@ public final class QueryBuilder { Method[] methods = object.getClass().getMethods(); for (Method method : methods) { - if (method.getName().startsWith("get") && method.getParameterTypes().length == 0) { + if (method.getName().startsWith("get") && method.getParameterTypes().length == 0 + && !method.isAnnotationPresent(JsonIgnore.class)) { String name = method.getName().substring(3); try { if (method.getReturnType().equals(boolean.class)) { @@ -424,7 +426,8 @@ public final class QueryBuilder { Method[] methods = clazz.getMethods(); for (final Method method : methods) { - if (method.getName().startsWith("set") && method.getParameterTypes().length == 1) { + if (method.getName().startsWith("set") && method.getParameterTypes().length == 1 + && !method.isAnnotationPresent(JsonIgnore.class)) { final String name = method.getName().substring(3); diff --git a/src/org/traccar/model/Geofence.java b/src/org/traccar/model/Geofence.java index f10ce6862..ffd4876bf 100644 --- a/src/org/traccar/model/Geofence.java +++ b/src/org/traccar/model/Geofence.java @@ -79,6 +79,7 @@ public class Geofence extends Extensible { return geometry; } + @JsonIgnore public void setGeometry(GeofenceGeometry geometry) { area = geometry.toWkt(); this.geometry = geometry; -- cgit v1.2.3