private JBossServiceConstructorConfig.Argument parseArgument(XMLExtendedStreamReader reader) throws XMLStreamException { String type = null; String value = null; final int count = reader.getAttributeCount(); final Set<Attribute> required = EnumSet.of(Attribute.TYPE, Attribute.VALUE); for(int i = 0; i < count; i++) { final Attribute attribute = Attribute.of(reader.getAttributeName(i)); required.remove(attribute); final String attributeValue = reader.getAttributeValue(i); switch(attribute) { case TYPE: type = attributeValue; break; case VALUE: value = attributeValue; break; default: throw unexpectedContent(reader); } } if(!required.isEmpty()) { throw missingAttributes(reader.getLocation(), required); } reader.discardRemainder(); return new JBossServiceConstructorConfig.Argument(type, value); }
private JBossServiceAttributeConfig.Inject parseInject(XMLExtendedStreamReader reader) throws XMLStreamException { final JBossServiceAttributeConfig.Inject injectConfig = new JBossServiceAttributeConfig.Inject(); final int count = reader.getAttributeCount(); final Set<Attribute> required = EnumSet.of(Attribute.BEAN); for(int i = 0; i < count; i++) { final Attribute attribute = Attribute.of(reader.getAttributeName(i)); required.remove(attribute); final String attributeValue = reader.getAttributeValue(i); switch(attribute) { case BEAN: injectConfig.setBeanName(attributeValue); break; case PROPERTY: injectConfig.setPropertyName(attributeValue); break; default: throw unexpectedContent(reader); } } if(!required.isEmpty()) { throw missingAttributes(reader.getLocation(), required); } reader.discardRemainder(); return injectConfig; }
final Set<Attribute> required = EnumSet.of(Attribute.NAME, Attribute.CODE); for(int i = 0; i < count; i++) { final Attribute attribute = Attribute.of(reader.getAttributeName(i)); required.remove(attribute); final String attributeValue = reader.getAttributeValue(i);
private JBossServiceAttributeConfig.ValueFactoryParameter parseValueFactoryParameter(XMLExtendedStreamReader reader) throws XMLStreamException { final JBossServiceAttributeConfig.ValueFactoryParameter parameterConfig = new JBossServiceAttributeConfig.ValueFactoryParameter(); final int count = reader.getAttributeCount(); final Set<Attribute> required = EnumSet.of(Attribute.CLASS); for(int i = 0; i < count; i++) { final Attribute attribute = Attribute.of(reader.getAttributeName(i)); required.remove(attribute); final String attributeValue = reader.getAttributeValue(i); switch(attribute) { case CLASS: parameterConfig.setType(attributeValue); break; default: throw unexpectedContent(reader); } } if(!required.isEmpty()) { throw missingAttributes(reader.getLocation(), required); } while (reader.hasNext()) { switch (reader.next()) { case END_ELEMENT: return parameterConfig; case CHARACTERS: parameterConfig.setValue(reader.getText()); break; } } throw unexpectedContent(reader); }
final Set<Attribute> required = EnumSet.of(Attribute.BEAN, Attribute.METHOD); for(int i = 0; i < count; i++) { final Attribute attribute = Attribute.of(reader.getAttributeName(i)); required.remove(attribute); final String attributeValue = reader.getAttributeValue(i);
private JBossServiceDependencyConfig parseDepends(final XMLExtendedStreamReader reader) throws XMLStreamException { final JBossServiceDependencyConfig dependencyConfig = new JBossServiceDependencyConfig(); final int count = reader.getAttributeCount(); for(int i = 0; i < count; i++) { final Attribute attribute = Attribute.of(reader.getAttributeName(i)); final String attributeValue = reader.getAttributeValue(i); switch(attribute) { case OPTIONAL_ATTRIBUTE_NAME: dependencyConfig.setOptionalAttributeName(attributeValue); break; case PROXY_TYPE: dependencyConfig.setProxyType(attributeValue); break; default: throw unexpectedContent(reader); } } parseDependency(reader, dependencyConfig); return dependencyConfig; }
final Set<Attribute> required = EnumSet.of(Attribute.NAME); for(int i = 0; i < count; i++) { final Attribute attribute = Attribute.of(reader.getAttributeName(i)); required.remove(attribute); final String attributeValue = reader.getAttributeValue(i);
final int count = reader.getAttributeCount(); for(int i = 0; i < count; i++) { final Attribute attribute = Attribute.of(reader.getAttributeName(i)); final String attributeValue = reader.getAttributeValue(i); switch(attribute) {
final QName attributeName = reader.getAttributeName(i); final Attribute attribute = Attribute.of(attributeName); final String attributeValue = reader.getAttributeValue(i);
/** * Get an exception reporting an unexpected XML attribute. * * @param reader the stream reader * @param index the attribute index * @return the exception */ public static XMLStreamException unexpectedAttribute(final XMLExtendedStreamReader reader, final int index) { return new XMLStreamException("Unexpected attribute '" + reader.getAttributeName(index) + "' encountered", reader.getLocation()); }
public static XMLStreamException unexpectedAttribute(final XMLExtendedStreamReader reader, final int index) { return new XMLStreamException(String.format("Unexpected attribute '%s' encountered", reader.getAttributeName(index)), reader.getLocation()); }
/** * Get an exception reporting an invalid XML attribute value. * * @param reader the stream reader * @param index the attribute index * @return the exception */ public static XMLStreamException invalidAttributeValue(final XMLExtendedStreamReader reader, final int index) { return new XMLStreamException("Invalid value '" + reader.getAttributeValue(index) + "' for attribute '" + reader.getAttributeName(index) + "'", reader.getLocation()); }
/** * Get an exception reporting an unexpected XML attribute. * @param reader the stream reader * @param index the attribute index * @return the exception */ public static XMLStreamException unexpectedAttribute(final XMLExtendedStreamReader reader, final int index) { return MESSAGES.unexpectedAttribute(reader.getAttributeName(index), reader.getLocation()); }
/** * Get an exception reporting an unexpected XML attribute. * @param reader the stream reader * @param index the attribute index * @return the exception */ public static XMLStreamException unexpectedAttribute(final XMLExtendedStreamReader reader, final int index) { return MESSAGES.unexpectedAttribute(reader.getAttributeName(index), reader.getLocation()); }
/** * Get an exception reporting an invalid XML attribute value. * @param reader the stream reader * @param index the attribute index * @return the exception */ public static XMLStreamException invalidAttributeValue(final XMLExtendedStreamReader reader, final int index) { return MESSAGES.invalidAttributeValue(reader.getAttributeValue(index), reader.getAttributeName(index), reader.getLocation()); }
/** * Get an exception reporting an invalid XML attribute value. * @param reader the stream reader * @param index the attribute index * @return the exception */ public static XMLStreamException invalidAttributeValue(final XMLExtendedStreamReader reader, final int index) { return MESSAGES.invalidAttributeValue(reader.getAttributeValue(index), reader.getAttributeName(index), reader.getLocation()); }
/** * Get an exception reporting an unexpected XML attribute. * @param reader the stream reader * @param index the attribute index * @return the exception */ public static XMLStreamException unexpectedAttribute(final XMLExtendedStreamReader reader, final int index) { final XMLStreamException ex = ControllerLogger.ROOT_LOGGER.unexpectedAttribute(reader.getAttributeName(index), reader.getLocation()); return new XMLStreamValidationException(ex.getMessage(), ValidationError.from(ex, ErrorType.UNEXPECTED_ATTRIBUTE) .element(reader.getName()) .attribute(reader.getAttributeName(index)), ex); }
/** * Get an exception reporting an unexpected XML attribute. * @param reader the stream reader * @param index the attribute index * @return the exception */ public static XMLStreamException unexpectedAttribute(final XMLExtendedStreamReader reader, final int index) { final XMLStreamException ex = ControllerLogger.ROOT_LOGGER.unexpectedAttribute(reader.getAttributeName(index), reader.getLocation()); return new XMLStreamValidationException(ex.getMessage(), ValidationError.from(ex, ErrorType.UNEXPECTED_ATTRIBUTE) .element(reader.getName()) .attribute(reader.getAttributeName(index)), ex); }
/** * Get an exception reporting an invalid XML attribute value. * @param reader the stream reader * @param index the attribute index * @return the exception */ public static XMLStreamException invalidAttributeValue(final XMLExtendedStreamReader reader, final int index) { final XMLStreamException ex = ControllerLogger.ROOT_LOGGER.invalidAttributeValue(reader.getAttributeValue(index), reader.getAttributeName(index), reader.getLocation()); return new XMLStreamValidationException(ex.getMessage(), ValidationError.from(ex, ErrorType.INVALID_ATTRIBUTE_VALUE) .element(reader.getName()) .attribute(reader.getAttributeName(index)) .attributeValue(reader.getAttributeValue(index)), ex); }
/** * Get an exception reporting an invalid XML attribute value. * @param reader the stream reader * @param index the attribute index * @return the exception */ public static XMLStreamException invalidAttributeValue(final XMLExtendedStreamReader reader, final int index) { final XMLStreamException ex = ControllerLogger.ROOT_LOGGER.invalidAttributeValue(reader.getAttributeValue(index), reader.getAttributeName(index), reader.getLocation()); return new XMLStreamValidationException(ex.getMessage(), ValidationError.from(ex, ErrorType.INVALID_ATTRIBUTE_VALUE) .element(reader.getName()) .attribute(reader.getAttributeName(index)) .attributeValue(reader.getAttributeValue(index)), ex); }