/** * Get an exception reporting a missing, required XML attribute. * @param reader the stream reader * @param required a set of enums whose toString method returns the * attribute name * @return the exception */ public static XMLStreamException missingRequired(final XMLExtendedStreamReader reader, final String... required) { final StringBuilder b = new StringBuilder(); for (int i = 0; i < required.length; i++) { final String o = required[i]; b.append(o); if (required.length > i + 1) { b.append(", "); } } return MESSAGES.missingRequiredAttributes(b, reader.getLocation()); }
/** * Get an exception reporting a missing, required XML attribute. * @param reader the stream reader * @param required a set of enums whose toString method returns the * attribute name * @return the exception */ public static XMLStreamException missingRequired(final XMLExtendedStreamReader reader, final Set<?> required) { final StringBuilder b = new StringBuilder(); Iterator<?> iterator = required.iterator(); while (iterator.hasNext()) { final Object o = iterator.next(); b.append(o.toString()); if (iterator.hasNext()) { b.append(", "); } } return MESSAGES.missingRequiredAttributes(b, reader.getLocation()); }
/** * Get an exception reporting a missing, required XML attribute. * @param reader the stream reader * @param required a set of enums whose toString method returns the * attribute name * @return the exception */ public static XMLStreamException missingRequired(final XMLExtendedStreamReader reader, final Set<?> required) { final StringBuilder b = new StringBuilder(); Iterator<?> iterator = required.iterator(); while (iterator.hasNext()) { final Object o = iterator.next(); b.append(o.toString()); if (iterator.hasNext()) { b.append(", "); } } return MESSAGES.missingRequiredAttributes(b, reader.getLocation()); }
throw MESSAGES.missingRequiredAttributes(new StringBuilder(NAME), reader.getLocation());
private ModelNode parseClientMapping(XMLExtendedStreamReader reader) throws XMLStreamException { final ModelNode mapping = new ModelNode(); boolean hasDestinationAddress = false; final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); if (!isNoNamespaceAttribute(reader, i)) { throw unexpectedAttribute(reader, i); } final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case SOURCE_NETWORK: AbstractSocketBindingResourceDefinition.CLIENT_MAPPING_SOURCE_NETWORK.parseAndSetParameter(value, mapping, reader); break; case DESTINATION_ADDRESS: AbstractSocketBindingResourceDefinition.CLIENT_MAPPING_DESTINATION_ADDRESS.parseAndSetParameter(value, mapping, reader); hasDestinationAddress = true; break; case DESTINATION_PORT: { AbstractSocketBindingResourceDefinition.CLIENT_MAPPING_DESTINATION_PORT.parseAndSetParameter(value, mapping, reader); break; } } } if (!hasDestinationAddress) { throw MESSAGES.missingRequiredAttributes(new StringBuilder(DESTINATION_ADDRESS), reader.getLocation()); } requireNoContent(reader); return mapping; }
private ModelNode parseClientMapping(XMLExtendedStreamReader reader) throws XMLStreamException { final ModelNode mapping = new ModelNode(); boolean hasDestinationAddress = false; final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); if (!isNoNamespaceAttribute(reader, i)) { throw unexpectedAttribute(reader, i); } final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case SOURCE_NETWORK: AbstractSocketBindingResourceDefinition.CLIENT_MAPPING_SOURCE_NETWORK.parseAndSetParameter(value, mapping, reader); break; case DESTINATION_ADDRESS: AbstractSocketBindingResourceDefinition.CLIENT_MAPPING_DESTINATION_ADDRESS.parseAndSetParameter(value, mapping, reader); hasDestinationAddress = true; break; case DESTINATION_PORT: { AbstractSocketBindingResourceDefinition.CLIENT_MAPPING_DESTINATION_PORT.parseAndSetParameter(value, mapping, reader); break; } } } if (!hasDestinationAddress) { throw MESSAGES.missingRequiredAttributes(new StringBuilder(DESTINATION_ADDRESS), reader.getLocation()); } requireNoContent(reader); return mapping; }