/** * This method just returns the bare object stored in the map, or null if * either the map didn't contain the object or the map is null. */ private Object getElementObject(ElementKey<?, ?> childKey) { return getElementObject(childKey.getId()); }
/** * This method just returns the bare object stored in the map, or null if * either the map didn't contain the object or the map is null. */ private Object getElementObject(ElementKey<?, ?> childKey) { return getElementObject(childKey.getId()); }
/** * This method just returns the bare object stored in the map, or null if * either the map didn't contain the object or the map is null. */ private Object getElementObject(ElementKey<?, ?> childKey) { return getElementObject(childKey.getId()); }
/** * Get child elements matching the specified id. This set cannot be used * to add new child elements, instead the {@link #addElement(Element)} method * should be used. */ public Set<Element> getElementSet(QName id) { // children, and if so add all of the wrapper junk we deal with in Multimap. ImmutableSet.Builder<Element> builder = ImmutableSet.builder(); Object obj = getElementObject(id); if (obj != null) { if (obj instanceof Element) { builder.add((Element) obj); } else { for (Element e : castElementCollection(obj)) { builder.add(e); } } } return builder.build(); }
/** * Get a child element matching the specified qualified name. * * @param id the qualified name of the child to retrieve * @return the matching child element, or {@code null} if none was found * @throws IllegalArgumentException if the id referenced a repeating element */ public Element getElement(QName id) { Object mapValue = getElementObject(id); if (mapValue instanceof Element) { return (Element) mapValue; } Preconditions.checkArgument(!(mapValue instanceof Collection<?>), "The getElement(*) method was called for a repeating element. " + "Use getElements(*) instead."); return null; }
/** * Returns an immutable list of elements matching the given id. */ public List<Element> getElements(QName id) { // children, and if so add all of the wrapper junk we deal with in Multimap. ImmutableList.Builder<Element> builder = ImmutableList.builder(); Object obj = getElementObject(id); if (obj != null) { if (obj instanceof Element) { builder.add((Element) obj); } else { for (Element e : castElementCollection(obj)) { builder.add(e); } } } return builder.build(); }
/** * Get a child element matching the specified qualified name. * * @param id the qualified name of the child to retrieve * @return the matching child element, or {@code null} if none was found * @throws IllegalArgumentException if the id referenced a repeating element */ public Element getElement(QName id) { Object mapValue = getElementObject(id); if (mapValue instanceof Element) { return (Element) mapValue; } Preconditions.checkArgument(!(mapValue instanceof Collection<?>), "The getElement(*) method was called for a repeating element. " + "Use getElements(*) instead."); return null; }
/** * Get a child element matching the specified qualified name. * * @param id the qualified name of the child to retrieve * @return the matching child element, or {@code null} if none was found * @throws IllegalArgumentException if the id referenced a repeating element */ public Element getElement(QName id) { Object mapValue = getElementObject(id); if (mapValue instanceof Element) { return (Element) mapValue; } Preconditions.checkArgument(!(mapValue instanceof Collection<?>), "The getElement(*) method was called for a repeating element. " + "Use getElements(*) instead."); return null; }
/** * Get child elements matching the specified id. This set cannot be used * to add new child elements, instead the {@link #addElement(Element)} method * should be used. */ public Set<Element> getElementSet(QName id) { // children, and if so add all of the wrapper junk we deal with in Multimap. ImmutableSet.Builder<Element> builder = ImmutableSet.builder(); Object obj = getElementObject(id); if (obj != null) { if (obj instanceof Element) { builder.add((Element) obj); } else { for (Element e : castElementCollection(obj)) { builder.add(e); } } } return builder.build(); }
/** * Returns an immutable list of elements matching the given id. */ public List<Element> getElements(QName id) { // children, and if so add all of the wrapper junk we deal with in Multimap. ImmutableList.Builder<Element> builder = ImmutableList.builder(); Object obj = getElementObject(id); if (obj != null) { if (obj instanceof Element) { builder.add((Element) obj); } else { for (Element e : castElementCollection(obj)) { builder.add(e); } } } return builder.build(); }
/** * Returns an immutable list of elements matching the given id. */ public List<Element> getElements(QName id) { // children, and if so add all of the wrapper junk we deal with in Multimap. ImmutableList.Builder<Element> builder = ImmutableList.builder(); Object obj = getElementObject(id); if (obj != null) { if (obj instanceof Element) { builder.add((Element) obj); } else { for (Element e : castElementCollection(obj)) { builder.add(e); } } } return builder.build(); }
/** * Get child elements matching the specified id. This set cannot be used * to add new child elements, instead the {@link #addElement(Element)} method * should be used. */ public Set<Element> getElementSet(QName id) { // children, and if so add all of the wrapper junk we deal with in Multimap. ImmutableSet.Builder<Element> builder = ImmutableSet.builder(); Object obj = getElementObject(id); if (obj != null) { if (obj instanceof Element) { builder.add((Element) obj); } else { for (Element e : castElementCollection(obj)) { builder.add(e); } } } return builder.build(); }
Object obj = getElementObject(key); if (obj != null) { Class<? extends T> childType = key.getElementType();
Object obj = getElementObject(key); if (obj != null) { Class<? extends T> childType = key.getElementType();
Object obj = getElementObject(key); if (obj != null) { Class<? extends T> childType = key.getElementType();
Object obj = getElementObject(key); if (obj != null) { Class<? extends T> childType = key.getElementType();
Object obj = getElementObject(key); if (obj != null) { Class<? extends T> childType = key.getElementType();
Object obj = getElementObject(key); if (obj != null) { Class<? extends T> childType = key.getElementType();
boolean removed = false; if (state.elements != null) { Object obj = getElementObject(childKey); if (obj instanceof Collection<?>) { Collection<Element> collect = castElementCollection(obj);
boolean removed = false; if (state.elements != null) { Object obj = getElementObject(childKey); if (obj instanceof Collection<?>) { Collection<Element> collect = castElementCollection(obj);