GH-817 - Properly guard for presence of jMolecules' @Module type.
As @Module is absent from the Kotlin flavor of jMolecules, code that refers to that is now guarded with a more specific check for that type in particular.
This commit is contained in:
@@ -44,7 +44,7 @@ interface ApplicationModuleInformation {
|
||||
|
||||
var rootPackage = javaPackage.toSingle();
|
||||
|
||||
return JMoleculesTypes.isPresent() && JMoleculesModule.supports(rootPackage)
|
||||
return JMoleculesTypes.isModulePresent() && JMoleculesModule.supports(rootPackage)
|
||||
? new JMoleculesModule(rootPackage)
|
||||
: new SpringModulithModule(rootPackage);
|
||||
}
|
||||
|
||||
@@ -51,21 +51,35 @@ class Types {
|
||||
private static final String MODULE = ANNOTATION_PACKAGE + ".Module";
|
||||
|
||||
private static final boolean PRESENT = ClassUtils.isPresent(AT_ENTITY, JMoleculesTypes.class.getClassLoader());
|
||||
private static final boolean MODULE_PRESENT = ClassUtils.isPresent(MODULE, JMoleculesTypes.class.getClassLoader());
|
||||
|
||||
static final String AT_DOMAIN_EVENT_HANDLER = BASE_PACKAGE + ".event.annotation.DomainEventHandler";
|
||||
static final String AT_DOMAIN_EVENT = BASE_PACKAGE + ".event.annotation.DomainEvent";
|
||||
static final String DOMAIN_EVENT = BASE_PACKAGE + ".event.types.DomainEvent";
|
||||
|
||||
/**
|
||||
* Returns whether jMolecules is generally present.
|
||||
*
|
||||
* @see #isModulePresent()
|
||||
*/
|
||||
public static boolean isPresent() {
|
||||
return PRESENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the jMolecules {@link Module} type is present. We need to guard for this explicitly as the Kotlin
|
||||
* variant of jMolecules DDD does not ship that type.
|
||||
*/
|
||||
public static boolean isModulePresent() {
|
||||
return MODULE_PRESENT;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Class<? extends Annotation> getModuleAnnotationTypeIfPresent() {
|
||||
|
||||
try {
|
||||
return isPresent()
|
||||
return isModulePresent()
|
||||
? (Class<? extends Annotation>) ClassUtils.forName(MODULE, JMoleculesTypes.class.getClassLoader())
|
||||
: null;
|
||||
} catch (Exception o_O) {
|
||||
|
||||
Reference in New Issue
Block a user