/** * Reads configuration. * * @return configuration * @throws JsonSyntaxException when parse fails * @throws IOException when read fails */ public static AttributeConfiguration readAttributeConfig() throws JsonParseException, IOException { GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.registerTypeAdapter(Attribute.class, new AttributeDeserializer()); Gson gson = gsonBuilder.create(); return gson.fromJson( readConfig(WriteReadType.NORMAL, ConfigType.ATTRIBUTE.getFileName()).toString(), AttributeConfiguration.class); }
/** * Writes configuration. * * @param writeType write type * @throws IOException when write fails */ public static void writeAttributeConfig(AttributeConfiguration config, WriteReadType writeType) throws IOException { Gson gson = new Gson(); writeConfig(gson.toJson(config), writeType, ConfigType.ATTRIBUTE.getFileName()); }