GH-111 - Package and publish Javadoc.
A lot of Javadoc polish. Not done yet.
This commit is contained in:
@@ -22,7 +22,9 @@ import java.util.Optional;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.jmolecules.ddd.annotation.Module;
|
||||
import org.springframework.modulith.ApplicationModule;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -34,24 +36,46 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
interface ApplicationModuleInformation {
|
||||
|
||||
/**
|
||||
* Creates a new {@link ApplicationModuleInformation} for the given {@link JavaPackage}.
|
||||
*
|
||||
* @param javaPackage must not be {@literal null}.
|
||||
* @return will never be {@literal null}.
|
||||
*/
|
||||
public static ApplicationModuleInformation of(JavaPackage javaPackage) {
|
||||
|
||||
if (ClassUtils.isPresent("org.jmolecules.ddd.annotation.Module",
|
||||
ApplicationModuleInformation.class.getClassLoader())
|
||||
&& MoleculesModule.supports(javaPackage)) {
|
||||
return new MoleculesModule(javaPackage);
|
||||
&& JMoleculesModule.supports(javaPackage)) {
|
||||
return new JMoleculesModule(javaPackage);
|
||||
}
|
||||
|
||||
return new ModulithsModule(javaPackage);
|
||||
return new SpringModulithModule(javaPackage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the display name to be used to describe the module.
|
||||
*
|
||||
* @return will never be {@literal null}.
|
||||
*/
|
||||
default Optional<String> getDisplayName() {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all allowed dependencies.
|
||||
*
|
||||
* @return will never be {@literal null}.
|
||||
*/
|
||||
List<String> getAllowedDependencies();
|
||||
|
||||
static class MoleculesModule implements ApplicationModuleInformation {
|
||||
/**
|
||||
* An {@link ApplicationModuleInformation} for the jMolecules {@link Module} annotation.
|
||||
*
|
||||
* @author Oliver Drotbohm
|
||||
* @see <a href="https://jmolecules.org">https://jMolecules.org</a>
|
||||
*/
|
||||
static class JMoleculesModule implements ApplicationModuleInformation {
|
||||
|
||||
private final Optional<org.jmolecules.ddd.annotation.Module> annotation;
|
||||
|
||||
@@ -59,7 +83,7 @@ interface ApplicationModuleInformation {
|
||||
return javaPackage.getAnnotation(org.jmolecules.ddd.annotation.Module.class).isPresent();
|
||||
}
|
||||
|
||||
public MoleculesModule(JavaPackage javaPackage) {
|
||||
public JMoleculesModule(JavaPackage javaPackage) {
|
||||
this.annotation = javaPackage.getAnnotation(org.jmolecules.ddd.annotation.Module.class);
|
||||
}
|
||||
|
||||
@@ -90,15 +114,33 @@ interface ApplicationModuleInformation {
|
||||
}
|
||||
}
|
||||
|
||||
static class ModulithsModule implements ApplicationModuleInformation {
|
||||
/**
|
||||
* An {@link ApplicationModuleInformation} that inspects the {@link ApplicationModule} annotation.
|
||||
*
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
static class SpringModulithModule implements ApplicationModuleInformation {
|
||||
|
||||
private final Optional<ApplicationModule> annotation;
|
||||
|
||||
/**
|
||||
* Whether the given {@link JavaPackage} supports this {@link ApplicationModuleInformation}.
|
||||
*
|
||||
* @param javaPackage must not be {@literal null}.
|
||||
*/
|
||||
public static boolean supports(JavaPackage javaPackage) {
|
||||
|
||||
Assert.notNull(javaPackage, "Java package must not be null!");
|
||||
|
||||
return javaPackage.getAnnotation(ApplicationModule.class).isPresent();
|
||||
}
|
||||
|
||||
public ModulithsModule(JavaPackage javaPackage) {
|
||||
/**
|
||||
* Creates a new {@link SpringModulithModule} for the given {@link JavaPackage}.
|
||||
*
|
||||
* @param javaPackage must not be {@literal null}.
|
||||
*/
|
||||
public SpringModulithModule(JavaPackage javaPackage) {
|
||||
this.annotation = javaPackage.getAnnotation(ApplicationModule.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ public class ApplicationModules implements Iterable<ApplicationModule> {
|
||||
* annotation on the class given for advanced customizations of the module setup.
|
||||
*
|
||||
* @param modulithType must not be {@literal null}.
|
||||
* @return
|
||||
* @return will never be {@literal null}.
|
||||
*/
|
||||
public static ApplicationModules of(Class<?> modulithType) {
|
||||
return of(modulithType, alwaysFalse());
|
||||
@@ -167,9 +167,8 @@ public class ApplicationModules implements Iterable<ApplicationModule> {
|
||||
* of the module setup.
|
||||
*
|
||||
* @param modulithType must not be {@literal null}.
|
||||
* @param detection must not be {@literal null}.
|
||||
* @param ignored must not be {@literal null}.
|
||||
* @return
|
||||
* @return will never be {@literal null}.
|
||||
*/
|
||||
public static ApplicationModules of(Class<?> modulithType, DescribedPredicate<JavaClass> ignored) {
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@ import com.tngtech.archunit.thirdparty.com.google.common.base.Supplier;
|
||||
import com.tngtech.archunit.thirdparty.com.google.common.base.Suppliers;
|
||||
|
||||
/**
|
||||
* An abstraction of a Java package.
|
||||
*
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
public class JavaPackage implements DescribedIterable<JavaClass> {
|
||||
|
||||
@@ -30,8 +30,8 @@ public interface ModulithMetadata {
|
||||
static final String ANNOTATION_MISSING = "Modules can only be retrieved from a root type, but %s is not annotated with either @%s, @%s or @%s!";
|
||||
|
||||
/**
|
||||
* Creates a new {@link ModulithMetadata} for the given annotated type. Expecteds the type either be annotated with
|
||||
* {@link Modulith}, {@link Modulithic} or {@link SpringBootApplication}.
|
||||
* Creates a new {@link ModulithMetadata} for the given annotated type. Expects the type either be annotated with
|
||||
* {@link Modulith}, {@link Modulithic} or {@link org.springframework.boot.autoconfigure.SpringBootApplication}.
|
||||
*
|
||||
* @param annotated must not be {@literal null}.
|
||||
* @return
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
/**
|
||||
* Core, internal abstractions of Spring Modulith.
|
||||
*/
|
||||
@org.springframework.lang.NonNullApi
|
||||
package org.springframework.modulith.model;
|
||||
|
||||
Reference in New Issue
Block a user