Updates JSON constructor to load from filesystem or Jar.
@@ -38,6 +38,9 @@ public class ScreenBuilder extends ComponentBuilder<Screen> {
* @param jsonFilePath
* The path to the JSON file.
*
+ * @param isInJar
+ * Whether or not to load the JSON from within the Jar file.
+ *
* @throws FileNotFoundException
* If the file does not exist, is a directory rather
* than a regular file, or for some other reason cannot
@@ -46,9 +49,13 @@ public class ScreenBuilder extends ComponentBuilder<Screen> {
* @throws ParseException
* If there's an error when parsing the JSON.
*/
- public ScreenBuilder(final @NonNull String jsonFilePath) throws FileNotFoundException, ParseException {
+ public ScreenBuilder(final @NonNull String jsonFilePath, final boolean isInJar) throws FileNotFoundException, ParseException {
+ if (isInJar) {
+ super.loadFromJSONInJar(jsonFilePath);
+ } else {
super.loadFromJSON(jsonFilePath);
}
+ }
@Override
public Screen build() {
