Commit 663bb459 authored by Raimbek Egemberdiev's avatar Raimbek Egemberdiev

Non null values

parent fbbacc33
......@@ -2,6 +2,7 @@ package kz.arta.synergy.api;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.codehaus.jackson.type.TypeReference;
import java.io.IOException;
......@@ -14,6 +15,7 @@ public class JsonUtils {
}
public static String toJson(Object object) throws IOException {
MAPPER.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
return MAPPER.writeValueAsString(object);
}
......@@ -26,10 +28,12 @@ public class JsonUtils {
}
public static <T> T read(String result, Class<T> synResponseClass) throws IOException {
MAPPER.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
return MAPPER.readValue(result, synResponseClass);
}
public static <T> T read(String result, TypeReference<T> typeReference) throws IOException {
MAPPER.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
return MAPPER.readValue(result, typeReference);
}
......
......@@ -86,6 +86,11 @@ public class AsFormProvider {
try {
Field[] allFields = asForm.getClass().getDeclaredFields();
for (Field field : allFields) {
field.setAccessible(true);
Object o = field.get(asForm);
if (o == null) {
continue;
}
Annotation[] declaredAnnotations = field.getDeclaredAnnotations();
for (Annotation annotation : declaredAnnotations) {
if (annotation instanceof TextBox) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment