private void validateExchangeDeclareArguments(final Map<String, Object> attributes, final Model model) { final ConfiguredObjectTypeRegistry typeRegistry = model.getTypeRegistry(); final List<ConfiguredObjectAttribute<?, ?>> types = new ArrayList<>(typeRegistry.getAttributeTypes(Exchange.class).values()); typeRegistry.getTypeSpecialisations(Exchange.class).forEach(type -> types.addAll(typeRegistry.getTypeSpecificAttributes(type))); final Set<String> unsupported = attributes.keySet() .stream() .filter(name -> types.stream().noneMatch(a -> Objects.equals(name, a.getName()) && !a.isDerived())) .collect(Collectors.toSet()); if (!unsupported.isEmpty()) { throw new IllegalArgumentException(String.format( "Unsupported exchange declare arguments : %s", String.join(",", unsupported))); } }
private void validateExchangeDeclareArguments(final Map<String, Object> attributes) { final ConfiguredObjectTypeRegistry typeRegistry = getModel().getTypeRegistry(); final List<ConfiguredObjectAttribute<?, ?>> types = new ArrayList<>(typeRegistry.getAttributeTypes(Exchange.class).values()); typeRegistry.getTypeSpecialisations(Exchange.class).forEach(type -> types.addAll(typeRegistry.getTypeSpecificAttributes(type))); final Set<String> unsupported = attributes.keySet() .stream() .filter(name -> types.stream().noneMatch(a -> Objects.equals(name, a.getName()) && !a.isDerived())) .collect(Collectors.toSet()); if (!unsupported.isEmpty()) { throw new IllegalArgumentException(String.format( "Unsupported exchange declare arguments : %s", String.join(",", unsupported))); } }
private void writeAttributes(final PrintWriter writer, final Class<? extends ConfiguredObject> configuredClass, final Model model, final List<Class<? extends ConfiguredObject>> types) { writer.println("<a name=\"types\"><h2>Attributes</h2></a>"); writer.println("<h2>Common Attributes</h2>"); writeAttributesTable(writer, model.getTypeRegistry().getAttributeTypes(configuredClass).values()); for(Class<? extends ConfiguredObject> type : types) { String typeName = getTypeName(type, model); Collection<ConfiguredObjectAttribute<?, ?>> typeSpecificAttributes = model.getTypeRegistry().getTypeSpecificAttributes(type); if(!typeSpecificAttributes.isEmpty()) { writer.println("<h2><span class=\"type\">"+typeName+"</span> Specific Attributes</h2>"); writeAttributesTable(writer, typeSpecificAttributes); } } }
new ArrayList<>(typeRegistry.getAttributeTypes(Queue.class).values()); typeRegistry.getTypeSpecialisations(Queue.class) .forEach(type -> attributeTypes.addAll(typeRegistry.getTypeSpecificAttributes(type)));