Class FeatureBuilder


  • public abstract class FeatureBuilder
    extends Object
    • Constructor Detail

      • FeatureBuilder

        public FeatureBuilder()
    • Method Detail

      • assemble

        public static Feature assemble​(Feature feature,
                                       BuilderContext context)
        Assemble the full feature by processing its prototype.
        Parameters:
        feature - The feature to start
        context - The builder context
        Returns:
        The assembled feature.
        Throws:
        IllegalArgumentException - If feature or context is null
        IllegalStateException - If a prototype feature can't be provided or merged.
      • resolve

        public static Feature[] resolve​(BuilderContext context,
                                        String... featureIds)
        Resolve a set of features based on their ids.
        Parameters:
        context - The builder context
        featureIds - The feature ids
        Returns:
        An array of features, the array has the same order as the provided ids
        Throws:
        IllegalArgumentException - If context or featureIds is null
        IllegalStateException - If the provided ids are invalid, or the feature can't be provided
      • deduplicate

        public static Feature[] deduplicate​(BuilderContext context,
                                            Feature... features)
        Remove duplicate and prototype features. If a feature with the same id but different version is contained several times, only the one with the highest version is kept in the result list. If a feature has another feature as prototype from the provided set, the prototype feature is removed from the set.
        Parameters:
        context - The builder context
        features - A list of features
        Returns:
        A list of features without duplicates.
      • assemble

        public static Feature assemble​(ArtifactId featureId,
                                       BuilderContext context,
                                       Feature... features)
        Assemble a feature based on the provided features. The features are processed in the order they are provided. If the same feature is included more than once only the feature with the highest version is used. The others are ignored.
        Parameters:
        featureId - The feature id to use.
        context - The builder context
        features - The features
        Returns:
        The application
        Throws:
        IllegalArgumentException - If featureId, context or featureIds is null
        IllegalStateException - If a feature can't be provided or the feature can't be assembled
      • resolveVariables

        public static void resolveVariables​(Feature feature,
                                            Map<String,​String> additionalVariables)
        Resolve variables in the feature. Variables are allowed in the values of framework properties and in the values of configuration properties.
        Parameters:
        feature - The feature
        additionalVariables - Optional additional variables