/** * Checks that a particular piece of metadata is not multiple cardinality. * * @throws IllegalStateException if the metadata is multiple cardinality */ private static void checkNotMultiple(ElementMetadata<?, ?> meta) { if (meta != null && meta.getCardinality() != Cardinality.SINGLE) { throw new IllegalStateException("Metadata for key " + meta.getKey() + " represents a multiple-cardinality element." + " The path cannot contain more than one multiple-cardinality" + " element."); } }
/** * Checks that a particular piece of metadata is not multiple cardinality. * * @throws IllegalStateException if the metadata is multiple cardinality */ private static void checkNotMultiple(ElementMetadata<?, ?> meta) { if (meta != null && meta.getCardinality() != Cardinality.SINGLE) { throw new IllegalStateException("Metadata for key " + meta.getKey() + " represents a multiple-cardinality element." + " The path cannot contain more than one multiple-cardinality" + " element."); } }
public Cardinality getCardinality() { return delegate().getCardinality(); }
public Cardinality getCardinality() { return delegate().getCardinality(); }
/** * Checks that a particular piece of metadata is not multiple cardinality. * * @throws IllegalStateException if the metadata is multiple cardinality */ private static void checkNotMultiple(ElementMetadata<?, ?> meta) { if (meta != null && meta.getCardinality() != Cardinality.SINGLE) { throw new IllegalStateException("Metadata for key " + meta.getKey() + " represents a multiple-cardinality element." + " The path cannot contain more than one multiple-cardinality" + " element."); } }
public Cardinality getCardinality() { return delegate().getCardinality(); }
&& childMetadata.getCardinality() == Cardinality.SINGLE) { throw new IllegalStateException("Metadata for key " + childKey + " represents a single-cardinality element."
&& childMetadata.getCardinality() == Cardinality.SINGLE) { throw new IllegalStateException("Metadata for key " + childKey + " represents a single-cardinality element."
&& childMetadata.getCardinality() == Cardinality.SINGLE) { throw new IllegalStateException("Metadata for key " + childKey + " represents a single-cardinality element."
|| childMetadata.getCardinality() == Cardinality.SINGLE) { Element child = getOrCreateChild(parent, childKey); parent = child;
|| childMetadata.getCardinality() == Cardinality.SINGLE) { Element child = getOrCreateChild(parent, childKey); parent = child;
|| childMetadata.getCardinality() == Cardinality.SINGLE) { Element child = getOrCreateChild(parent, childKey); parent = child;
/** * Default child handler for xml. This will parse into a {@link Element} if * the element has not been declared, otherwise it will parse into the type * defined by the metadata. * * @throws ParseException if a non-repeating element is repeated, or if the * element type requested cannot be created. * @throws IOException from overriding code. Not thrown by the default * implementation. */ @Override public XmlHandler getChildHandler(QName qName, Attributes attrs, List<XmlNamespace> namespaces) throws ParseException, IOException { ElementMetadata<?, ?> childMeta = findMetadata(qName); Element childElement = createChildElement(qName, childMeta); // "SET" cardinality elements cannot be added to the parent element until // fully initialized, otherwise we'll have duplicates. So we track the // parent element and add to it after the element has been processed. Element parent; if (childMeta != null && childMeta.getCardinality() == Cardinality.SET) { parent = element; } else { element.addElement(childElement); parent = null; } return createHandler(qName, parent, childElement, childMeta); }
/** * Default child handler for xml. This will parse into a {@link Element} if * the element has not been declared, otherwise it will parse into the type * defined by the metadata. * * @throws ParseException if a non-repeating element is repeated, or if the * element type requested cannot be created. * @throws IOException from overriding code. Not thrown by the default * implementation. */ @Override public XmlHandler getChildHandler(QName qName, Attributes attrs, List<XmlNamespace> namespaces) throws ParseException, IOException { ElementMetadata<?, ?> childMeta = findMetadata(qName); Element childElement = createChildElement(qName, childMeta); // "SET" cardinality elements cannot be added to the parent element until // fully initialized, otherwise we'll have duplicates. So we track the // parent element and add to it after the element has been processed. Element parent; if (childMeta != null && childMeta.getCardinality() == Cardinality.SET) { parent = element; } else { element.addElement(childElement); parent = null; } return createHandler(qName, parent, childElement, childMeta); }
/** * Default child handler for xml. This will parse into a {@link Element} if * the element has not been declared, otherwise it will parse into the type * defined by the metadata. * * @throws ParseException if a non-repeating element is repeated, or if the * element type requested cannot be created. * @throws IOException from overriding code. Not thrown by the default * implementation. */ @Override public XmlHandler getChildHandler(QName qName, Attributes attrs, List<XmlNamespace> namespaces) throws ParseException, IOException { ElementMetadata<?, ?> childMeta = findMetadata(qName); Element childElement = createChildElement(qName, childMeta); // "SET" cardinality elements cannot be added to the parent element until // fully initialized, otherwise we'll have duplicates. So we track the // parent element and add to it after the element has been processed. Element parent; if (childMeta != null && childMeta.getCardinality() == Cardinality.SET) { parent = element; } else { element.addElement(childElement); parent = null; } return createHandler(qName, parent, childElement, childMeta); }