/** * Get the StringNodes which represents a specific key. If there is no node for this key, a new * node is created and returned * * @param key the StringNode key attribute * @param isArray if it's an array or not * @return the StringNode which represents the key passed as a parameter */ public StringNode getStringNodeByKey(String key, boolean isArray) { StringNode result = stringNodesMap.get(key); if (result == null) { StringNode newNode = new StringNode(key, ""); newNode.setLocalizationFile(this); newNode.setArray(isArray); result = this.addStringNode(newNode); } return result; }
/** * Set the list of StringArrays which are part of the file * * @param stringArrays the list of StringArrays which are part of the file */ public void setStringArrays(List<StringArray> stringArrays) { if (stringArrays != null) { for (StringArray stringArray : stringArrays) { List<StringNode> stringNodes = stringArray.getValues(); for (StringNode stringNode : stringNodes) { this.stringNodesMap.put(stringNode.getKey(), stringNode); stringNode.setLocalizationFile(this); stringNode.setArray(true); } this.stringNodes.addAll(stringNodes); } this.stringArrays.addAll(stringArrays); } }