/** * Parse a Map and reconstruct the {@link SafariOptions}. A temporary directory is created to hold * all Safari extension files. * * @param options A Map derived from the output of {@link #toJson()}. * @return A {@link SafariOptions} instance associated with these extensions. * @throws IOException If an error occurred while writing the safari extensions to a temporary * directory. */ @SuppressWarnings("unchecked") private static SafariOptions fromJsonMap(Map options) throws IOException { SafariOptions safariOptions = new SafariOptions(); Number port = (Number) options.get(Option.PORT); if (port != null) { safariOptions.setPort(port.intValue()); } Boolean useCleanSession = (Boolean) options.get(Option.CLEAN_SESSION); if (useCleanSession != null) { safariOptions.setUseCleanSession(useCleanSession); } return safariOptions; }