private void validateRequiredProperties(ComponentDefinition<? extends Implementation<?>> definition, XMLStreamReader reader, IntrospectionContext context) { AbstractComponentType<?, ?, ?, ?> type = definition.getImplementation().getComponentType(); Map<String, ? extends Property> properties = type.getProperties(); Map<String, PropertyValue> values = definition.getPropertyValues(); for (Property property : properties.values()) { if (property.isRequired() && !values.containsKey(property.getName())) { RequiredPropertyNotProvided failure = new RequiredPropertyNotProvided(property, definition.getName(), reader); context.addError(failure); } } }
private void parseProperty(ComponentDefinition<Implementation<?>> componentDefinition, AbstractComponentType<?, ?, ?, ?> componentType, XMLStreamReader reader, IntrospectionContext context) throws XMLStreamException, UnrecognizedElementException { PropertyValue value; value = registry.load(reader, PropertyValue.class, context); if (value == null) { // there was an error with the property configuration, just skip it return; } if (!componentType.hasProperty(value.getName())) { // ensure the property exists ComponentPropertyNotFound failure = new ComponentPropertyNotFound(value.getName(), componentDefinition, reader); context.addError(failure); return; } if (componentDefinition.getPropertyValues().containsKey(value.getName())) { String id = value.getName(); DuplicateConfiguredProperty failure = new DuplicateConfiguredProperty(id, componentDefinition, reader); context.addError(failure); } else { componentDefinition.add(value); } }
Map<String, PropertyValue> propertyValues = definition.getPropertyValues(); ComponentType componentType = definition.getComponentType(); LogicalCompositeComponent parent = component.getParent();