diff --git a/s-pipes-core/src/main/java/cz/cvut/spipes/modules/AnnotatedAbstractModule.java b/s-pipes-core/src/main/java/cz/cvut/spipes/modules/AnnotatedAbstractModule.java index bca26e2e..00390bd5 100644 --- a/s-pipes-core/src/main/java/cz/cvut/spipes/modules/AnnotatedAbstractModule.java +++ b/s-pipes-core/src/main/java/cz/cvut/spipes/modules/AnnotatedAbstractModule.java @@ -1,5 +1,6 @@ package cz.cvut.spipes.modules; +import cz.cvut.spipes.exception.ModuleConfigurationInconsistentException; import cz.cvut.spipes.modules.handlers.*; import org.apache.jena.rdf.model.ResourceFactory; import org.slf4j.Logger; @@ -9,6 +10,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Stack; /** * The `AnnotatedAbstractModule` class extends the `AbstractModule` class and provides @@ -30,23 +32,24 @@ public abstract class AnnotatedAbstractModule extends AbstractModule { *
This method is responsible for processing the fields declared in the class and its superclasses, * that are annotated with {@link Parameter}. It ensures that each field is processed only once and * verifies that no two fields share the same {@link Parameter#iri()}. If a duplicate is found, - * it throws a {@link RuntimeException}. + * it throws a {@link ModuleConfigurationInconsistentException}. * *
For each annotated field: *
The method continues processing all declared fields, moving up through the class hierarchy - * until it reaches the {@code AnnotatedAbstractModule} class itself. + *
This method processes all declared fields in the class and its subclasses, + * moving down through the class hierarchy until it reaches the most derived class. + * This ensures that all relevant fields are considered for configuration.
* *After all automatically configurable fields have been processed, it invokes the
* {@link #loadManualConfiguration()} method to allow subclasses to handle any custom configuration
* that requires manual intervention.
*
- * @throws RuntimeException if two or more fields in the class hierarchy share the same
+ * @throws ModuleConfigurationInconsistentException if two or more fields in the class hierarchy share the same
* {@link Parameter#iri()}.
*/
@Override
@@ -54,14 +57,22 @@ public void loadConfiguration() {
Class extends AnnotatedAbstractModule> clazz = this.getClass();
- while(clazz != AnnotatedAbstractModule.class){
+ Stack