/** * Returns the value of the attribute with the given name of the wrapped * node. * * @param key the key of the attribute * @return the value of this attribute */ public Object getAttribute(final String key) { return handler.getAttributeValue(node, key); }
@Override public Object getAttributeValue(final T node, final String name) { return getDecoratedNodeHandler().getAttributeValue(node, name); }
/** * Helper method for checking whether an attribute is defined and adding it * to the list of attributes to iterate over. * * @param parent the parent node pointer * @param result the result list * @param name the name of the current attribute */ private void addAttributeData(final ConfigurationNodePointer<T> parent, final List<String> result, final String name) { if (parent.getNodeHandler().getAttributeValue( parent.getConfigurationNode(), name) != null) { result.add(name); } } }
/** * Populates a map with interpolated attributes of the passed in node. * * @param node the current node to be processed * @param handler the {@code NodeHandler} * @param interpolatedAttributes a map for storing the results * @return a flag whether an attribute value was changed by * interpolation */ private boolean interpolateAttributes(final ImmutableNode node, final NodeHandler<ImmutableNode> handler, final Map<String, Object> interpolatedAttributes) { boolean attributeChanged = false; for (final String attr : handler.getAttributes(node)) { final Object attrValue = interpolate(handler.getAttributeValue(node, attr)); if (valueChanged(attrValue, handler.getAttributeValue(node, attr))) { attributeChanged = true; } interpolatedAttributes.put(attr, attrValue); } return attributeChanged; }
/** * Returns the attribute value if this is an attribute result. If this is * not an attribute result, an exception is thrown. * * @param handler the {@code NodeHandler} * @return the attribute value * @throws IllegalStateException if this is not an attribute result */ public Object getAttributeValue(final NodeHandler<T> handler) { if (!isAttributeResult()) { throw new IllegalStateException("This is not an attribute result! " + "Attribute value cannot be fetched."); } return handler.getAttributeValue(getNode(), getAttributeName()); }
/** * Handles the attributes during a combination process. First all attributes * of the first node are added to the result. Then all attributes of the * second node, which are not contained in the first node, are also added. * * @param result the resulting node * @param node1 the first node * @param node2 the second node */ protected void addAttributes(final ImmutableNode.Builder result, final ImmutableNode node1, final ImmutableNode node2) { result.addAttributes(node1.getAttributes()); for (final String attr : node2.getAttributes().keySet()) { if (!node1.getAttributes().containsKey(attr)) { result.addAttribute(attr, HANDLER.getAttributeValue(node2, attr)); } } }
if (handler.getAttributeValue(node, key) != null)