Skip to content

Commit

Permalink
gson to jackson
Browse files Browse the repository at this point in the history
  • Loading branch information
boubbrah committed Oct 3, 2017
1 parent b3a0d78 commit 3c4671b
Show file tree
Hide file tree
Showing 31 changed files with 445 additions and 61 deletions.
4 changes: 2 additions & 2 deletions online-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
</dependency-->

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>javax</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

import javax.json.stream.JsonGenerator;

import com.google.gson.Gson;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
*
Expand All @@ -29,9 +31,13 @@ protected String getType() {

@Override
public String toJson() {
Gson gson = new Gson();
return gson.toJson(this);

ObjectMapper json = new ObjectMapper();
json.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
try {
return json.writeValueAsString(this);
} catch (Exception e) {
return "";
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

import javax.json.stream.JsonGenerator;

import com.google.gson.Gson;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
*
Expand All @@ -29,8 +31,13 @@ protected String getType() {

@Override
public String toJson() {
Gson gson = new Gson();
return gson.toJson(this);
ObjectMapper json = new ObjectMapper();
json.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
try {
return json.writeValueAsString(this);
} catch (Exception e) {
return "";
}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

import javax.json.stream.JsonGenerator;

import com.google.gson.Gson;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;

import eu.itesla_project.online.server.OnlineWorkflowInfo;

Expand All @@ -33,8 +35,13 @@ protected String getType() {

@Override
public String toJson() {
Gson gson = new Gson();
return gson.toJson(this);
ObjectMapper json = new ObjectMapper();
json.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
try {
return json.writeValueAsString(this);
} catch (Exception e) {
return "";
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

import javax.json.stream.JsonGenerator;

import com.google.gson.Gson;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;

import eu.itesla_project.online.StableContingenciesSynthesis;

Expand All @@ -33,9 +35,13 @@ protected String getType() {

@Override
public String toJson() {
Gson gson = new Gson();
return gson.toJson(this);

ObjectMapper json = new ObjectMapper();
json.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
try {
return json.writeValueAsString(this);
} catch (Exception e) {
return "";
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

import javax.json.stream.JsonGenerator;

import com.google.gson.Gson;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;

import eu.itesla_project.online.ContingencyStatesActionsSynthesis;

Expand All @@ -31,10 +33,14 @@ protected String getType() {

@Override
public String toJson() {
Gson gson = new Gson();
return gson.toJson(this);

}
ObjectMapper json = new ObjectMapper();
json.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
try {
return json.writeValueAsString(this);
} catch (Exception e) {
return "";
}
}

@Override
public void toJson(JsonGenerator generator) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

import javax.json.stream.JsonGenerator;

import com.google.gson.Gson;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;

import eu.itesla_project.online.ContingencyStatesIndexesSynthesis;

Expand All @@ -31,9 +33,13 @@ protected String getType() {

@Override
public String toJson() {
Gson gson = new Gson();
return gson.toJson(this);

ObjectMapper json = new ObjectMapper();
json.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
try {
return json.writeValueAsString(this);
} catch (Exception e) {
return "";
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

import javax.json.stream.JsonGenerator;

import com.google.gson.Gson;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;

import eu.itesla_project.online.IndexSecurityRulesResultsSynthesis;

Expand All @@ -32,9 +34,13 @@ protected String getType() {

@Override
public String toJson() {
Gson gson = new Gson();
return gson.toJson(this);

ObjectMapper json = new ObjectMapper();
json.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
try {
return json.writeValueAsString(this);
} catch (Exception e) {
return "";
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

import javax.json.stream.JsonGenerator;

import com.google.gson.Gson;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;

import eu.itesla_project.online.StatusSynthesis;

Expand All @@ -31,9 +33,13 @@ protected String getType() {

@Override
public String toJson() {
Gson gson = new Gson();
return gson.toJson(this);

ObjectMapper json = new ObjectMapper();
json.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
try {
return json.writeValueAsString(this);
} catch (Exception e) {
return "";
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

import javax.json.stream.JsonGenerator;

import com.google.gson.Gson;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;

import eu.itesla_project.online.UnstableContingenciesSynthesis;

Expand All @@ -32,8 +34,13 @@ protected String getType() {

@Override
public String toJson() {
Gson gson = new Gson();
return gson.toJson(this);
ObjectMapper json = new ObjectMapper();
json.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
try {
return json.writeValueAsString(this);
} catch (Exception e) {
return "";
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

import javax.json.stream.JsonGenerator;

import com.google.gson.Gson;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;

import eu.itesla_project.online.WcaContingenciesSynthesis;

Expand All @@ -32,8 +34,13 @@ protected String getType() {

@Override
public String toJson() {
Gson gson = new Gson();
return gson.toJson(this);
ObjectMapper json = new ObjectMapper();
json.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
try {
return json.writeValueAsString(this);
} catch (Exception e) {
return "";
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

import javax.json.stream.JsonGenerator;

import com.google.gson.Gson;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;

import eu.itesla_project.online.RunningSynthesis;

Expand All @@ -31,9 +33,13 @@ protected String getType() {

@Override
public String toJson() {
Gson gson = new Gson();
return gson.toJson(this);

ObjectMapper json = new ObjectMapper();
json.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
try {
return json.writeValueAsString(this);
} catch (Exception e) {
return "";
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

import javax.json.stream.JsonGenerator;

import com.google.gson.Gson;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;


/**
*
Expand All @@ -32,8 +35,13 @@ protected String getType() {

@Override
public String toJson() {
Gson gson = new Gson();
return gson.toJson(this);
ObjectMapper json = new ObjectMapper();
json.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
try {
return json.writeValueAsString(this);
} catch (Exception e) {
return "";
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
package eu.itesla_project.online.server.message;

import javax.json.stream.JsonGenerator;
import com.google.gson.Gson;

import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;

import eu.itesla_project.online.WorkSynthesis;

/**
Expand All @@ -29,10 +33,14 @@ protected String getType() {

@Override
public String toJson() {
Gson gson = new Gson();
return gson.toJson(this);

}
ObjectMapper json = new ObjectMapper();
json.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
try {
return json.writeValueAsString(this);
} catch (Exception e) {
return "";
}
}

@Override
protected void toJson(JsonGenerator generator) {
Expand Down

0 comments on commit 3c4671b

Please sign in to comment.