diff --git a/pipeline.yml b/pipeline.yml index f42dd7c..96f8162 100644 --- a/pipeline.yml +++ b/pipeline.yml @@ -17,6 +17,26 @@ resources: source: url: {{slack-url}} +slack-failure: &slack-failure + put: slack + params: + attachments: + - color: danger + fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " + text: " Build has failed" + title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" + title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + +slack-success: &slack-success + put: slack + params: + attachments: + - color: good + fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " + text: "Build has succeeded" + title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" + title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + jobs: - name: build plan: @@ -106,23 +126,3 @@ jobs: spring_password: {{spring-password}} on_failure: *slack-failure on_success: *slack-success - -slack-failure: &slack-failure - put: slack - params: - attachments: - - color: danger - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: " Build has failed" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME - -slack-success: &slack-success - put: slack - params: - attachments: - - color: good - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Build has succeeded" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME diff --git a/src/main/java/org/springframework/classify/SubclassClassifier.java b/src/main/java/org/springframework/classify/SubclassClassifier.java index 3f2bfdd..34d0e2f 100644 --- a/src/main/java/org/springframework/classify/SubclassClassifier.java +++ b/src/main/java/org/springframework/classify/SubclassClassifier.java @@ -85,6 +85,16 @@ public class SubclassClassifier implements Classifier { this.classified = new ConcurrentHashMap, C>(map); } + /** + * Add a classification. The keys is the type and this will be mapped along with all + * subclasses to the corresponding value. The most specific types will match first. + * @param type the type of the input object + * @param target the target value for all such types + */ + public void add(Class type, C target) { + this.classified.put(type, target); + } + /** * Return the value from the type map whose key is the class of the given Throwable, * or its nearest ancestor if a subclass.