/** * Checks whether this node pointer refers to an attribute node. This method * checks the attribute flag of the associated configuration node. * * @return the attribute flag */ @Override public boolean isAttribute() { return node.isAttribute(); }
/** * Checks whether this node pointer refers to an attribute node. This method * checks the attribute flag of the associated configuration node. * * @return the attribute flag */ @Override public boolean isAttribute() { return node.isAttribute(); }
if (node1.isAttribute() && !node2.isAttribute()) else if (node2.isAttribute() && !node1.isAttribute()) List<ConfigurationNode> subNodes = node1.isAttribute() ? node.getAttributes() : node .getChildren(); for (ConfigurationNode child : subNodes)
if (node1.isAttribute() && !node2.isAttribute()) else if (node2.isAttribute() && !node1.isAttribute()) List<ConfigurationNode> subNodes = node1.isAttribute() ? node.getAttributes() : node .getChildren(); for (ConfigurationNode child : subNodes)
/** * Checks if the specified node is reserved and thus should be ignored. This * method is called when the maps for the bean's properties and complex * properties are collected. It checks whether the given node is an * attribute node and if its name starts with the reserved prefix. * * @param nd the node to be checked * @return a flag whether this node is reserved (and does not point to a * property) */ protected boolean isReservedNode(ConfigurationNode nd) { return nd.isAttribute() && (nd.getName() == null || nd.getName().startsWith( RESERVED_PREFIX)); }
/** * Checks if the specified node is reserved and thus should be ignored. This * method is called when the maps for the bean's properties and complex * properties are collected. It checks whether the given node is an * attribute node and if its name starts with the reserved prefix. * * @param nd the node to be checked * @return a flag whether this node is reserved (and does not point to a * property) */ protected boolean isReservedNode(ConfigurationNode nd) { return nd.isAttribute() && (nd.getName() == null || nd.getName().startsWith( RESERVED_PREFIX)); }
/** * Visits and copies the specified node. * * @param node the node */ @Override public void visitBeforeChildren(ConfigurationNode node) { ConfigurationNode copy = (ConfigurationNode) node.clone(); copy.setParentNode(null); if (!copyStack.isEmpty()) { if (node.isAttribute()) { copyStack.peek().addAttribute(copy); } else { copyStack.peek().addChild(copy); } } copyStack.push(copy); }
buf.append(PATH_DELIMITER); if (node.isAttribute())
buf.append(PATH_DELIMITER); if (node.isAttribute())
/** * Visits and copies the specified node. * * @param node the node */ @Override public void visitBeforeChildren(ConfigurationNode node) { ConfigurationNode copy = (ConfigurationNode) node.clone(); copy.setParentNode(null); if (!copyStack.isEmpty()) { if (node.isAttribute()) { copyStack.peek().addAttribute(copy); } else { copyStack.peek().addChild(copy); } } copyStack.push(copy); }
/** * Checks whether the given node is reserved. This method will take * further reserved attributes into account * * @param nd the node * @return a flag whether this node is reserved */ @Override protected boolean isReservedNode(ConfigurationNode nd) { if (super.isReservedNode(nd)) { return true; } return nd.isAttribute() && ((ATTR_ATNAME.equals(nd.getName()) && nd.getParentNode() .getAttributeCount(RESERVED_PREFIX + ATTR_ATNAME) == 0) || (ATTR_OPTIONALNAME .equals(nd.getName()) && nd.getParentNode() .getAttributeCount(RESERVED_PREFIX + ATTR_OPTIONALNAME) == 0)); }
/** * Checks whether the given node is reserved. This method will take * further reserved attributes into account * * @param nd the node * @return a flag whether this node is reserved */ @Override protected boolean isReservedNode(ConfigurationNode nd) { if (super.isReservedNode(nd)) { return true; } return nd.isAttribute() && ((ATTR_ATNAME.equals(nd.getName()) && nd.getParentNode() .getAttributeCount(RESERVED_PREFIX + ATTR_ATNAME) == 0) || (ATTR_OPTIONALNAME .equals(nd.getName()) && nd.getParentNode() .getAttributeCount(RESERVED_PREFIX + ATTR_OPTIONALNAME) == 0)); }
if (parent.isAttribute()) if (child.isAttribute())
if (parent.isAttribute()) if (child.isAttribute())
if (node.isAttribute())
if (node.isAttribute())
/** * Converts the specified node into a {@code XMLNode} if necessary. * This is required for nodes that are directly added, e.g. by * {@code addNodes()}. If the passed in node is already an instance * of {@code XMLNode}, it is directly returned, and conversion * stops. Otherwise a new {@code XMLNode} is created, and the * children are also converted. * * @param node the node to be converted * @return the converted node */ private XMLNode convertToXMLNode(ConfigurationNode node) { if (node instanceof XMLNode) { return (XMLNode) node; } XMLNode nd = (XMLNode) createNode(node.getName()); nd.setValue(node.getValue()); nd.setAttribute(node.isAttribute()); for (ConfigurationNode child : node.getChildren()) { nd.addChild(convertToXMLNode(child)); } for (ConfigurationNode attr : node.getAttributes()) { nd.addAttribute(convertToXMLNode(attr)); } return nd; }
/** * Converts the specified node into a {@code XMLNode} if necessary. * This is required for nodes that are directly added, e.g. by * {@code addNodes()}. If the passed in node is already an instance * of {@code XMLNode}, it is directly returned, and conversion * stops. Otherwise a new {@code XMLNode} is created, and the * children are also converted. * * @param node the node to be converted * @return the converted node */ private XMLNode convertToXMLNode(ConfigurationNode node) { if (node instanceof XMLNode) { return (XMLNode) node; } XMLNode nd = (XMLNode) createNode(node.getName()); nd.setValue(node.getValue()); nd.setAttribute(node.isAttribute()); for (ConfigurationNode child : node.getChildren()) { nd.addChild(convertToXMLNode(child)); } for (ConfigurationNode attr : node.getAttributes()) { nd.addAttribute(convertToXMLNode(attr)); } return nd; }