Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WFCORE-6806 Add method to combine multiple DeploymentServiceInstaller #5981

Merged
merged 1 commit into from
Apr 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
*/
package org.wildfly.subsystem.service;

import java.util.Collection;
import java.util.List;

import org.jboss.as.server.deployment.DeploymentPhaseContext;

/**
Expand All @@ -16,4 +19,29 @@ public interface DeploymentServiceInstaller {
* @param context a deployment phase context
*/
void install(DeploymentPhaseContext context);

/**
* Returns a composite {@link DeploymentServiceInstaller} that installs the specified installers.
* @param installers a variable number of installers
* @return a composite installer
*/
static DeploymentServiceInstaller combine(DeploymentServiceInstaller... installers) {
return combine(List.of(installers));
}

/**
* Returns a composite {@link DeploymentServiceInstaller} that installs the specified installers.
* @param installers a collection of installers
* @return a composite installer
*/
static DeploymentServiceInstaller combine(Collection<? extends DeploymentServiceInstaller> installers) {
return new DeploymentServiceInstaller() {
@Override
public void install(DeploymentPhaseContext context) {
for (DeploymentServiceInstaller installer : installers) {
installer.install(context);
}
}
};
}
}