All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.nemerosa.ontrack.model.extension.ExtensionFeatureOptions Maven / Gradle / Ivy

There is a newer version: 4.4.5
Show newest version
package net.nemerosa.ontrack.model.extension;

import lombok.Data;
import lombok.experimental.Builder;
import lombok.experimental.Wither;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

/**
 * Options for a feature
 */
@Data
@Builder
public class ExtensionFeatureOptions {

    /**
     * Default options
     */
    public static final ExtensionFeatureOptions DEFAULT = builder()
            .gui(false)
            .dependencies(Collections.emptySet())
            .build();

    /**
     * Does the extension provides some web components?
     */
    @Wither
    private final boolean gui;

    /**
     * List of extensions IDs this feature depends on.
     */
    @Wither
    private final Set dependencies;

    /**
     * Adds a dependency
     */
    public ExtensionFeatureOptions withDependency(ExtensionFeature feature) {
        Set existing = this.dependencies;
        Set newDependencies;
        if (existing == null) {
            newDependencies = new HashSet<>();
        } else {
            newDependencies = new HashSet<>(existing);
        }
        newDependencies.add(feature.getId());
        return withDependencies(newDependencies);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy