Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
synergy-api-util
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Raimbek Egemberdiev
synergy-api-util
Commits
663bb459
Commit
663bb459
authored
Nov 10, 2016
by
Raimbek Egemberdiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Non null values
parent
fbbacc33
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
src/main/java/kz/arta/synergy/api/JsonUtils.java
src/main/java/kz/arta/synergy/api/JsonUtils.java
+4
-0
src/main/java/kz/arta/synergy/api/asforms/AsFormProvider.java
...main/java/kz/arta/synergy/api/asforms/AsFormProvider.java
+5
-0
No files found.
src/main/java/kz/arta/synergy/api/JsonUtils.java
View file @
663bb459
...
...
@@ -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
);
}
...
...
src/main/java/kz/arta/synergy/api/asforms/AsFormProvider.java
View file @
663bb459
...
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment