Skip to content

Commit c6e8874

Browse files
committed
Support for non-inherited stereotypes.
1 parent 0866740 commit c6e8874

File tree

5 files changed

+16
-17
lines changed

5 files changed

+16
-17
lines changed

jmolecules-architecture/jmolecules-hexagonal-architecture/src/main/java/org/jmolecules/architecture/hexagonal/Port.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
@Retention(RetentionPolicy.RUNTIME)
4242
@Target({ ElementType.PACKAGE, ElementType.TYPE })
4343
@Documented
44-
@Stereotype(priority = 300)
44+
@Stereotype(priority = 300, inherited = false)
4545
public @interface Port {
4646

4747
/**

jmolecules-architecture/jmolecules-hexagonal-architecture/src/main/java/org/jmolecules/architecture/hexagonal/PrimaryPort.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
@Retention(RetentionPolicy.RUNTIME)
3838
@Target({ ElementType.PACKAGE, ElementType.TYPE })
3939
@Documented
40-
@Stereotype(priority = 100)
40+
@Stereotype(priority = 100, inherited = false)
4141
public @interface PrimaryPort {
4242

4343
/**

jmolecules-architecture/jmolecules-hexagonal-architecture/src/main/java/org/jmolecules/architecture/hexagonal/SecondaryPort.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
@Retention(RetentionPolicy.RUNTIME)
3939
@Target({ ElementType.PACKAGE, ElementType.TYPE })
4040
@Documented
41-
@Stereotype(priority = 200)
41+
@Stereotype(priority = 200, inherited = false)
4242
public @interface SecondaryPort {
4343

4444
/**

jmolecules-architecture/jmolecules-hexagonal-architecture/src/main/resources/META-INF/jmolecules-stereotypes.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,24 @@
2626
"@org.jmolecules.architecture.hexagonal.PrimaryPort"
2727
],
2828
"groups" : [ "architecture.hexagonal" ],
29-
"priority" : 100
29+
"priority" : 100,
30+
"inherited" : false
3031
},
3132
"architecture.hexagonal.SecondaryPort" : {
3233
"assignments" : [
3334
"@org.jmolecules.architecture.hexagonal.SecondaryPort"
3435
],
3536
"groups" : [ "architecture.hexagonal" ],
36-
"priority" : 200
37+
"priority" : 200,
38+
"inherited" : false
3739
},
3840
"architecture.hexagonal.Port" : {
3941
"assignments" : [
4042
"@org.jmolecules.architecture.hexagonal.Port"
4143
],
4244
"groups" : [ "architecture.hexagonal" ],
43-
"priority" : 300
45+
"priority" : 300,
46+
"inherited" : false
4447
},
4548
"architecture.hexagonal.Application" : {
4649
"assignments" : [

jstereotype/src/main/java/org/jmolecules/stereotype/Stereotype.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,38 +35,34 @@
3535

3636
/**
3737
* Alias of the {@link #name()} attribute.
38-
*
39-
* @return
4038
*/
4139
String value() default "";
4240

4341
/**
4442
* A human-readable name of the stereotype. Defaults to the simple name of the annotated type or concrete annotation
4543
* respectively.
46-
*
47-
* @return
4844
*/
4945
String name() default "";
5046

5147
/**
5248
* The identifier of the stereotype. Defaults to the fully qualified name of the annotated type or concrete annotation
5349
* respectively.
54-
*
55-
* @return
5650
*/
5751
String id() default "";
5852

5953
/**
60-
* The logical identifiers a stereotype belongs to.
61-
*
62-
* @return
54+
* The logical identifiers of the groups a stereotype belongs to.
6355
*/
6456
String[] groups() default {};
6557

6658
/**
6759
* A priority (lower value implies higher priority) of the stereotype.
68-
*
69-
* @return
7060
*/
7161
int priority() default 0;
62+
63+
/**
64+
* Configures whether the stereotype is only detected on the type or method itself or by inspecting the entire
65+
* inheritance hierarchy. Defaults to {@literal true}.
66+
*/
67+
boolean inherited() default true;
7268
}

0 commit comments

Comments
 (0)