Skip to content

Commit 6708628

Browse files
author
jantje
committed
#1339 packages Seem to work.
Still needs lots of cleanup
1 parent 3d8ae10 commit 6708628

27 files changed

+2270
-2212
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package io.sloeber.core.Gson;
2+
3+
import com.google.gson.JsonElement;
4+
import com.google.gson.JsonObject;
5+
6+
import io.sloeber.core.api.VersionNumber;
7+
8+
public class GsonConverter {
9+
public static String getSafeString(JsonObject jsonObject, String fieldName) {
10+
JsonElement field = jsonObject.get(fieldName);
11+
if (field == null) {
12+
return "no info found in file"; //$NON-NLS-1$
13+
}
14+
return field.getAsString();
15+
16+
}
17+
18+
public static VersionNumber getSafeVersion(JsonObject jsonObject, String fieldName) {
19+
JsonElement field = jsonObject.get(fieldName);
20+
if (field == null) {
21+
return new VersionNumber("no version number provided"); //$NON-NLS-1$
22+
}
23+
return new VersionNumber(field.getAsString());
24+
25+
}
26+
27+
public static String getSafeString(JsonObject jsonObject, String fieldName1, String fieldName2) {
28+
JsonElement field = jsonObject.get(fieldName1);
29+
if (field != null) {
30+
field = field.getAsJsonObject().get(fieldName2);
31+
if (field != null) {
32+
return field.getAsString();
33+
}
34+
}
35+
36+
return "no info found in file"; //$NON-NLS-1$
37+
38+
}
39+
40+
}

io.sloeber.core/src/io/sloeber/core/Gson/LibraryDeserializer.java

-54
This file was deleted.

io.sloeber.core/src/io/sloeber/core/Gson/LibraryIndexJson.java

-171
This file was deleted.

io.sloeber.core/src/io/sloeber/core/api/BoardDescription.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
2323
import org.eclipse.core.runtime.preferences.InstanceScope;
2424

25+
import io.sloeber.core.api.Json.packages.ArduinoPlatform;
2526
import io.sloeber.core.common.Common;
2627
import io.sloeber.core.common.ConfigurationPreferences;
27-
import io.sloeber.core.managers.ArduinoPlatform;
2828
import io.sloeber.core.managers.InternalPackageManager;
2929
import io.sloeber.core.tools.Helpers;
3030
import io.sloeber.core.tools.KeyValue;

0 commit comments

Comments
 (0)