@Override public List<ModuleConfiguration> getModules() { return config.getModules(); }
/** * Finds all configuration modules of given {@code moduleType} within this configuration. * * @param moduleType The type of the configuration module * @param <T> The type of the configuration module * @return configuration modules of {@code moduleType} defined in this configuration */ @SuppressWarnings("unchecked") default <T extends ModuleConfiguration> List<T> findModules(Class<T> moduleType) { return getModules().stream() .filter(m -> m.isType(moduleType)) .map(m -> (T) m.unwrap()) .collect(Collectors.toList()); }
/** * Returns the {@link EventProcessingConfiguration} defined in this Configuration. If there aren't any defined, * {@code null} will be returned. If there is exactly one, it will be returned. For case when there are multiple, * an {@link AxonConfigurationException} is thrown and the {@link #getModules()} API should be used instead. * * @return the {@link EventProcessingConfiguration} defined in this Configuration * * @throws AxonConfigurationException thrown if there are more than one Event Processing Configurations defined with * this configuration */ default EventProcessingConfiguration eventProcessingConfiguration() throws AxonConfigurationException { List<EventProcessingConfiguration> eventProcessingModules = getModules().stream() .filter(module -> module.isType(EventProcessingConfiguration.class)) .map(module -> (EventProcessingConfiguration) module.unwrap()) .collect(Collectors.toList()); switch (eventProcessingModules.size()) { case 0: return null; case 1: return eventProcessingModules.get(0); default: throw new AxonConfigurationException( "There are several EventProcessingConfigurations defined. Use findModules(Class<T>) method instead."); } }
/** * Finds all configuration modules of given {@code moduleType} within this configuration. * * @param moduleType The type of the configuration module * @param <T> The type of the configuration module * @return configuration modules of {@code moduleType} defined in this configuration */ @SuppressWarnings("unchecked") default <T extends ModuleConfiguration> List<T> findModules(Class<T> moduleType) { return getModules().stream() .filter(m -> moduleType.isInstance(m.unwrap())) .map(m -> (T) m.unwrap()) .collect(Collectors.toList()); }
/** * Finds all configuration modules of given {@code moduleType} within this configuration. * * @param moduleType The type of the configuration module * @param <T> The type of the configuration module * @return configuration modules of {@code moduleType} defined in this configuration */ @SuppressWarnings("unchecked") default <T extends ModuleConfiguration> List<T> findModules(Class<T> moduleType) { return getModules().stream() .filter(m -> m.isType(moduleType)) .map(m -> (T) m.unwrap()) .collect(Collectors.toList()); }
/** * Returns the {@link EventProcessingConfiguration} defined in this Configuration. If there aren't any defined, * {@code null} will be returned. If there is exactly one, it will be returned. For case when there are multiple, * an {@link AxonConfigurationException} is thrown and the {@link #getModules()} API should be used instead. * * @return the {@link EventProcessingConfiguration} defined in this Configuration * * @throws AxonConfigurationException thrown if there are more than one Event Processing Configurations defined with * this configuration */ default EventProcessingConfiguration eventProcessingConfiguration() throws AxonConfigurationException { List<EventProcessingConfiguration> eventProcessingModules = getModules().stream() .filter(module -> module.isType(EventProcessingConfiguration.class)) .map(module -> (EventProcessingConfiguration) module.unwrap()) .collect(Collectors.toList()); switch (eventProcessingModules.size()) { case 0: return null; case 1: return eventProcessingModules.get(0); default: throw new AxonConfigurationException( "There are several EventProcessingConfigurations defined. Use findModules(Class<T>) method instead."); } }