bound, parent, parentMetadata, elements.size()); ElementKey<?, ?> childKey = bound.getSelectedElementKey(); ElementMetadata<?, ?> childMetadata = bound.getSelectedElement();
bound, parent, parentMetadata, elements.size()); ElementKey<?, ?> childKey = bound.getSelectedElementKey(); ElementMetadata<?, ?> childMetadata = bound.getSelectedElement();
bound, parent, parentMetadata, elements.size()); ElementKey<?, ?> childKey = bound.getSelectedElementKey(); ElementMetadata<?, ?> childMetadata = bound.getSelectedElement();
/** * Returns the last element along the path, starting with the given root * element. If at any point there is no valid element this method will return * {@code null}. If the path ends in an attribute key this will return the * parent of that attribute, if it ends in an element key it will return that * element. * * @throws NullPointerException if the root or path is null. * @throws IllegalArgumentException if there are any repeating elements along * the path. */ static Element getFinalElement(Path path, Element rootElement) { Element parent = getParentElement(path, rootElement); if (path.selectsAttribute() || parent == null) { return parent; } return parent.getElement(path.getSelectedElementKey()); }
/** * Returns the last element along the path, starting with the given root * element. If at any point there is no valid element this method will return * {@code null}. If the path ends in an attribute key this will return the * parent of that attribute, if it ends in an element key it will return that * element. * * @throws NullPointerException if the root or path is null. * @throws IllegalArgumentException if there are any repeating elements along * the path. */ static Element getFinalElement(Path path, Element rootElement) { Element parent = getParentElement(path, rootElement); if (path.selectsAttribute() || parent == null) { return parent; } return parent.getElement(path.getSelectedElementKey()); }
/** * Returns the last element along the path, starting with the given root * element. If at any point there is no valid element this method will return * {@code null}. If the path ends in an attribute key this will return the * parent of that attribute, if it ends in an element key it will return that * element. * * @throws NullPointerException if the root or path is null. * @throws IllegalArgumentException if there are any repeating elements along * the path. */ static Element getFinalElement(Path path, Element rootElement) { Element parent = getParentElement(path, rootElement); if (path.selectsAttribute() || parent == null) { return parent; } return parent.getElement(path.getSelectedElementKey()); }
/** * Returns the element creator at the end of the path by looking it up * directly in the registry (not traversing). */ private ElementCreatorImpl getElementCreator(Path path) { Preconditions.checkArgument(path.selectsElement(), "Must be an element path"); ElementKey<?, ?> parent = path.getParentKey(); if (parent == null) { parent = elementKey; } ElementKey<?, ?> selected = path.getSelectedElementKey(); return (ElementCreatorImpl) registry.build( parent, selected, transformKey.getContext()); }
/** * Returns the element creator at the end of the path by looking it up * directly in the registry (not traversing). */ private ElementCreatorImpl getElementCreator(Path path) { Preconditions.checkArgument(path.selectsElement(), "Must be an element path"); ElementKey<?, ?> parent = path.getParentKey(); if (parent == null) { parent = elementKey; } ElementKey<?, ?> selected = path.getSelectedElementKey(); return (ElementCreatorImpl) registry.build( parent, selected, transformKey.getContext()); }
/** * Returns the element creator at the end of the path by looking it up * directly in the registry (not traversing). */ private ElementCreatorImpl getElementCreator(Path path) { Preconditions.checkArgument(path.selectsElement(), "Must be an element path"); ElementKey<?, ?> parent = path.getParentKey(); if (parent == null) { parent = elementKey; } ElementKey<?, ?> selected = path.getSelectedElementKey(); return (ElementCreatorImpl) registry.build( parent, selected, transformKey.getContext()); }
/** * Parses a single element using this path. This will follow the path until * the second to last element on the path, and then parse into the final * element using the real parent instead of the path's parent. * * elements along it. */ public void parse(Element parent, ElementMetadata<?, ?> parentMetadata, Element element, ElementMetadata<?, ?> metadata) throws ParseException { Preconditions.checkState(path.selectsElement(), "An attribute path cannot be used to parse elements."); parent = createParentElement(path, parent); ElementKey<?, ?> lastKey = path.getSelectedElementKey(); try { Element child = Element.createElement(lastKey, element); parent.addElement(child); } catch (ContentCreationException e) { throw new ParseException(e); } }
/** * Parses a single element using this path. This will follow the path until * the second to last element on the path, and then parse into the final * element using the real parent instead of the path's parent. * * elements along it. */ public void parse(Element parent, ElementMetadata<?, ?> parentMetadata, Element element, ElementMetadata<?, ?> metadata) throws ParseException { Preconditions.checkState(path.selectsElement(), "An attribute path cannot be used to parse elements."); parent = createParentElement(path, parent); ElementKey<?, ?> lastKey = path.getSelectedElementKey(); try { Element child = Element.createElement(lastKey, element); parent.addElement(child); } catch (ContentCreationException e) { throw new ParseException(e); } }
/** * Parses a single element using this path. This will follow the path until * the second to last element on the path, and then parse into the final * element using the real parent instead of the path's parent. * * elements along it. */ public void parse(Element parent, ElementMetadata<?, ?> parentMetadata, Element element, ElementMetadata<?, ?> metadata) throws ParseException { Preconditions.checkState(path.selectsElement(), "An attribute path cannot be used to parse elements."); parent = createParentElement(path, parent); ElementKey<?, ?> lastKey = path.getSelectedElementKey(); try { Element child = Element.createElement(lastKey, element); parent.addElement(child); } catch (ContentCreationException e) { throw new ParseException(e); } }
/** * Travels along the path, creating any elements that don't exist until it * gets to the final key. If the final key is an element, it creates that * element if necessary and returns it. If the final key is an attribute, it * returns the parent of that attribute. */ static Element createFinalElement(Path path, Element rootElement) throws ParseException { Element parent = createParentElement(path, rootElement); if (path.selectsAttribute() || parent == null) { return parent; } ElementKey<?, ?> childKey = path.getSelectedElementKey(); Element child = parent.getElement(childKey); if (child == null) { try { child = Element.createElement(childKey); parent.addElement(child); } catch (ContentCreationException e) { throw new ParseException(e); } } return child; }
/** * Travels along the path, creating any elements that don't exist until it * gets to the final key. If the final key is an element, it creates that * element if necessary and returns it. If the final key is an attribute, it * returns the parent of that attribute. */ static Element createFinalElement(Path path, Element rootElement) throws ParseException { Element parent = createParentElement(path, rootElement); if (path.selectsAttribute() || parent == null) { return parent; } ElementKey<?, ?> childKey = path.getSelectedElementKey(); Element child = parent.getElement(childKey); if (child == null) { try { child = Element.createElement(childKey); parent.addElement(child); } catch (ContentCreationException e) { throw new ParseException(e); } } return child; }
/** * Travels along the path, creating any elements that don't exist until it * gets to the final key. If the final key is an element, it creates that * element if necessary and returns it. If the final key is an attribute, it * returns the parent of that attribute. */ static Element createFinalElement(Path path, Element rootElement) throws ParseException { Element parent = createParentElement(path, rootElement); if (path.selectsAttribute() || parent == null) { return parent; } ElementKey<?, ?> childKey = path.getSelectedElementKey(); Element child = parent.getElement(childKey); if (child == null) { try { child = Element.createElement(childKey); parent.addElement(child); } catch (ContentCreationException e) { throw new ParseException(e); } } return child; }