Element (@NotNull AbstractColorsScheme scheme, String... properties) { Element root = new Element("scheme"); scheme.writeExternal(root); fixPlatformSpecificValues(root); Element metaInfo = root.getChild("metaInfo"); if (metaInfo == null) { return root; } List<Element> toRemove = new ArrayList<>(); for (Element element : metaInfo.getChildren()) { Attribute name = element.getAttribute("name"); boolean result = false; for (String t : properties) { if (t.equals(name.getValue())) { result = true; break; } } if (!element.getName().equals("property") || name == null || !result) { toRemove.add(element); } } for (Element child : toRemove) { metaInfo.removeContent(child); } return root; }