This repository was archived by the owner on Jun 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Check: Program to Interface, Not Implementation
Madeline Kahn edited this page Mar 11, 2024
·
2 revisions
- Name:
"programToInterface" - Default: Enabled
| Name | Type | Description |
|---|---|---|
domainPackageName |
String |
Name of the domain package (default is "domain"). |
adapterClassNameRegex |
String |
Regular expression for adapter class names, to exempt from this check (default is "Adapter$"). |
allowedDependencies |
String[] |
List of user-specified allowed dependencies (add known interfaces and/or data classes here). |
For each class in the domain package, generates a warning if any field types, method return types, or method parameter types do not meet at least one of the following criteria for acceptable dependencies:
- Type is also defined in the domain package.
- Type is a primitive, or a class representing a primitive.
- Type is an interface/enum defined within the project. (Interfaces defined elsewhere cannot be automatically detected; please add them to
allowedDependenciesto suppress warnings). - Type is
Object. - Type is one of a few popular data structure interfaces.
- Type is in the user-configured
allowedDependencies.
Adapter classes (as specified by adapterClassNameRegex) are ignored.