-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to AbstractStatusChecksProperties class. (#52)
* Deprecate the StatusChecksProperties interface and add AbstractStatusChecksProperties class insead. * Rename isSkip method to isSkipped. * Clean up
- Loading branch information
1 parent
6113479
commit 3ca4e19
Showing
3 changed files
with
110 additions
and
33 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
src/main/java/io/jenkins/plugins/checks/status/AbstractStatusChecksProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package io.jenkins.plugins.checks.status; | ||
|
||
import hudson.ExtensionPoint; | ||
import hudson.model.Job; | ||
|
||
/** | ||
* Extension points for implementations to provide status checks properties. | ||
* | ||
* When no implementations is provided for a job, a {@link DefaultStatusCheckProperties} will be used. | ||
*/ | ||
public abstract class AbstractStatusChecksProperties implements ExtensionPoint { | ||
/** | ||
* Returns whether the implementation is applicable for the {@code job}. | ||
* | ||
* @param job | ||
* A jenkins job. | ||
* @return true if applicable | ||
*/ | ||
public abstract boolean isApplicable(Job<?, ?> job); | ||
|
||
/** | ||
* Returns the name of the status check. | ||
* | ||
* @param job | ||
* A jenkins job. | ||
* @return the name of the status check | ||
*/ | ||
public abstract String getName(Job<?, ?> job); | ||
|
||
/** | ||
* Returns whether to skip publishing status checks. | ||
* | ||
* @param job | ||
* A jenkins job. | ||
* @return true if skip | ||
*/ | ||
public abstract boolean isSkipped(Job<?, ?> job); | ||
} | ||
|
||
class DefaultStatusCheckProperties extends AbstractStatusChecksProperties { | ||
@Override | ||
public boolean isApplicable(final Job<?, ?> job) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public String getName(final Job<?, ?> job) { | ||
return "Jenkins"; | ||
} | ||
|
||
@Override | ||
public boolean isSkipped(final Job<?, ?> job) { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters