-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Still needs lots of cleanup
- Loading branch information
jantje
committed
Nov 7, 2021
1 parent
3d8ae10
commit 6708628
Showing
27 changed files
with
2,270 additions
and
2,212 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
io.sloeber.core/src/io/sloeber/core/Gson/GsonConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package io.sloeber.core.Gson; | ||
|
||
import com.google.gson.JsonElement; | ||
import com.google.gson.JsonObject; | ||
|
||
import io.sloeber.core.api.VersionNumber; | ||
|
||
public class GsonConverter { | ||
public static String getSafeString(JsonObject jsonObject, String fieldName) { | ||
JsonElement field = jsonObject.get(fieldName); | ||
if (field == null) { | ||
return "no info found in file"; //$NON-NLS-1$ | ||
} | ||
return field.getAsString(); | ||
|
||
} | ||
|
||
public static VersionNumber getSafeVersion(JsonObject jsonObject, String fieldName) { | ||
JsonElement field = jsonObject.get(fieldName); | ||
if (field == null) { | ||
return new VersionNumber("no version number provided"); //$NON-NLS-1$ | ||
} | ||
return new VersionNumber(field.getAsString()); | ||
|
||
} | ||
|
||
public static String getSafeString(JsonObject jsonObject, String fieldName1, String fieldName2) { | ||
JsonElement field = jsonObject.get(fieldName1); | ||
if (field != null) { | ||
field = field.getAsJsonObject().get(fieldName2); | ||
if (field != null) { | ||
return field.getAsString(); | ||
} | ||
} | ||
|
||
return "no info found in file"; //$NON-NLS-1$ | ||
|
||
} | ||
|
||
} |
54 changes: 0 additions & 54 deletions
54
io.sloeber.core/src/io/sloeber/core/Gson/LibraryDeserializer.java
This file was deleted.
Oops, something went wrong.
171 changes: 0 additions & 171 deletions
171
io.sloeber.core/src/io/sloeber/core/Gson/LibraryIndexJson.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.