GH-177 - Named interfaces names now default to the local package name.

Both package- and type-level declarations now use the local package name as the named interface's name. This allows to, at the same time, easily declared named interfaces based on packages but also a nice decoupling of the interface definition and the package layout as individual types can be assigned to such interfaces no matter where they are actually declared.
This commit is contained in:
Oliver Drotbohm
2023-03-31 13:34:21 +02:00
parent 6d2fdd6fdc
commit 2454ecbc4b
13 changed files with 266 additions and 155 deletions

View File

@@ -24,8 +24,7 @@ import java.lang.annotation.Target;
import org.springframework.core.annotation.AliasFor;
/**
* Annotation to mark a package as named interface of a {@link ApplicationModule} (either implicit or explicitly
* annotated).
* Annotation to mark a package as named interface of a {@link ApplicationModule} or assign a type to a named interface.
*
* @author Oliver Drotbohm
*/
@@ -35,19 +34,21 @@ import org.springframework.core.annotation.AliasFor;
public @interface NamedInterface {
/**
* The name(s) of the named interface. Declaring multiple values here is useful in case named interfaces are defined
* based on types and a particular type is supposed to be part of multiple named interfaces.
* The name(s) of the named interface. If declared on a package, the package's local name will be used as default
* name. Declaring multiple values here is useful in case named interfaces are defined based on types and a particular
* type is supposed to be part of multiple named interfaces.
*
* @return
* @return will never be {@literal null}.
*/
@AliasFor("name")
String[] value() default {};
/**
* The name(s) of the named interface. Declaring multiple values here is useful in case named interfaces are defined
* based on types and a particular type is supposed to be part of multiple named interfaces.
* The name(s) of the named interface. If declared on a package, the package's local name will be used as default
* name. Declaring multiple values here is useful in case named interfaces are defined based on types and a particular
* type is supposed to be part of multiple named interfaces.
*
* @return
* @return will never be {@literal null}.
*/
@AliasFor("value")
String[] name() default {};