Class ApplicationModule

java.lang.Object
org.springframework.modulith.core.ApplicationModule

public class ApplicationModule extends Object
An application module.
Author:
Oliver Drotbohm
  • Constructor Details

    • ApplicationModule

      ApplicationModule(JavaPackage basePackage, boolean useFullyQualifiedModuleNames)
      Creates a new ApplicationModule for the given base package and whether to use fully-qualified module names.
      Parameters:
      basePackage - must not be null.
      useFullyQualifiedModuleNames -
  • Method Details

    • getBasePackage

      public JavaPackage getBasePackage()
      Returns the module's base package.
      Returns:
      the basePackage
    • getNamedInterfaces

      public NamedInterfaces getNamedInterfaces()
      Returns all NamedInterfaces exposed by the module.
      Returns:
      the namedInterfaces will never be null.
    • getName

      public String getName()
      Returns the logical name of the module.
      Returns:
      will never be null or empty.
    • getDisplayName

      public String getDisplayName()
      Returns the name of the ApplicationModule for display purposes.
      Returns:
      will never be null or empty.
    • getDependencies

      public ApplicationModuleDependencies getDependencies(ApplicationModules modules, DependencyType... type)
      Parameters:
      modules - must not be null.
      type - must not be null.
      Returns:
      will never be null.
    • getEventsListenedTo

      public List<com.tngtech.archunit.core.domain.JavaClass> getEventsListenedTo(ApplicationModules modules)
      Returns all event types the current module exposes an event listener for.
      Parameters:
      modules - must not be null.
      Returns:
    • getPublishedEvents

      public List<EventType> getPublishedEvents()
      Returns all EventTypes published by the module.
      Returns:
      will never be null.
    • getValueTypes

      public List<com.tngtech.archunit.core.domain.JavaClass> getValueTypes()
      Returns all value types contained in the module.
      Returns:
      will never be null.
    • getAggregateRoots

      public List<com.tngtech.archunit.core.domain.JavaClass> getAggregateRoots()
      Returns all types that are considered aggregate roots.
      Returns:
      will never be null.
    • getBootstrapDependencies

      public Stream<ApplicationModule> getBootstrapDependencies(ApplicationModules modules)
      Returns all modules that contain types which the types of the current module depend on.
      Parameters:
      modules - must not be null.
      Returns:
    • getBootstrapDependencies

      public Stream<ApplicationModule> getBootstrapDependencies(ApplicationModules modules, DependencyDepth depth)
    • getBootstrapBasePackages

      public Stream<JavaPackage> getBootstrapBasePackages(ApplicationModules modules, DependencyDepth depth)
      Returns all JavaPackage for the current module including the ones by its dependencies.
      Parameters:
      modules - must not be null.
      depth - must not be null.
      Returns:
    • getSpringBeans

      public List<SpringBean> getSpringBeans()
      Returns all SpringBeans contained in the module.
      Returns:
      will never be null.
    • getArchitecturallyEvidentType

      public ArchitecturallyEvidentType getArchitecturallyEvidentType(Class<?> type)
      Returns the ArchitecturallyEvidentType for the given type.
      Parameters:
      type - must not be null.
      Returns:
      will never be null.
      Throws:
      IllegalArgumentException - if the given type is not a module type.
    • contains

      public boolean contains(com.tngtech.archunit.core.domain.JavaClass type)
    • contains

      public boolean contains(@Nullable Class<?> type)
    • getType

      public Optional<com.tngtech.archunit.core.domain.JavaClass> getType(String candidate)
      Returns the JavaClass for the given candidate simple of fully-qualified type name.
      Parameters:
      candidate - must not be null or empty.
      Returns:
      will never be null.
    • isExposed

      public boolean isExposed(com.tngtech.archunit.core.domain.JavaClass type)
      Returns whether the given JavaClass is exposed by the current module, i.e. whether it's part of any of the module's named interfaces.
      Parameters:
      type - must not be null.
      Returns:
    • verifyDependencies

      public void verifyDependencies(ApplicationModules modules)
    • detectDependencies

      public Violations detectDependencies(ApplicationModules modules)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public String toString(@Nullable ApplicationModules modules)
    • getSpringBeansInternal

      Classes getSpringBeansInternal()
    • getDeclaredDependencies

      Returns all declared module dependencies, either explicitly declared or defined as shared on the given ApplicationModules instance.
      Parameters:
      modules - must not be null.
      Returns:
    • contains

      boolean contains(String candidate)
      Returns whether the given module contains a type with the given simple or fully qualified name.
      Parameters:
      candidate - must not be null or empty.
      Returns:
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object