private void declareSubtypes(ExtensionDeclarer extension, List<MessageDispatcherProviderTypeWrapper> transportProviders) { if (!transportProviders.isEmpty()) { List<MetadataType> types = transportProviders.stream().map(TypeWrapper::asMetadataType).collect(toList()); extension.withSubTypes(typeLoader.load(MessageDispatcherProvider.class), types); } }
private void declareSubTypesMapping(ExtensionDeclarer declarer, List<AnnotationValueFetcher<SubTypeMapping>> typeMappings, String name) { if (typeMappings.stream().map(valueFetcher -> valueFetcher.getClassValue(SubTypeMapping::baseType)).distinct() .collect(toList()).size() != typeMappings.size()) { throw new IllegalModelDefinitionException(String .format("There should be only one SubtypeMapping for any given base type in extension [%s]." + " Duplicated base types are not allowed", name)); } typeMappings.forEach(mapping -> declarer.withSubTypes(mapping.getClassValue(SubTypeMapping::baseType).asMetadataType(), mapping.getClassArrayValue(SubTypeMapping::subTypes).stream() .map(Type::asMetadataType) .collect(toImmutableList()))); }
private void declareSubTypesMapping(ExtensionDeclarer declarer, List<AnnotationValueFetcher<SubTypeMapping>> typeMappings, String name) { if (typeMappings.stream().map(valueFetcher -> valueFetcher.getClassValue(SubTypeMapping::baseType)).distinct() .collect(toList()).size() != typeMappings.size()) { throw new IllegalModelDefinitionException(String .format("There should be only one SubtypeMapping for any given base type in extension [%s]." + " Duplicated base types are not allowed", name)); } typeMappings.forEach(mapping -> declarer.withSubTypes(mapping.getClassValue(SubTypeMapping::baseType).asMetadataType(), mapping.getClassArrayValue(SubTypeMapping::subTypes).stream() .map(Type::asMetadataType) .collect(toImmutableList()))); }