Interface FeaturesBuilder

  • All Superinterfaces:
    java.lang.Iterable<Feature>

    @NotThreadSafe
    public interface FeaturesBuilder
    extends java.lang.Iterable<Feature>
    A mutable builder for a Feature with a fluent API.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Features build()
      Creates a new Features object containing all features which were set to this builder beforehand.
      java.util.Optional<Feature> get​(java.lang.CharSequence featureId)
      Returns the Feature with the specified identifier from this builder or an empty Optional if such a Feature is unknown to this builder.
      FeaturesBuilder remove​(java.lang.String featureId)
      Removes the Feature with the given ID from this builder.
      FeaturesBuilder remove​(Feature feature)
      Removes the given Feature from this builder.
      FeaturesBuilder removeAll()
      Removes all previously set Features.
      FeaturesBuilder set​(Feature feature)
      Sets the given Feature to this builder.
      FeaturesBuilder setAll​(java.lang.Iterable<Feature> features)
      Sets all given Features to this builder.
      • Methods inherited from interface java.lang.Iterable

        forEach, iterator, spliterator
    • Method Detail

      • set

        FeaturesBuilder set​(Feature feature)
        Sets the given Feature to this builder. A previously set Feature with the same ID is replaced.
        Parameters:
        feature - the Feature to be set.
        Returns:
        this builder to allow method chaining.
        Throws:
        java.lang.NullPointerException - if feature is null.
      • get

        java.util.Optional<Feature> get​(java.lang.CharSequence featureId)
        Returns the Feature with the specified identifier from this builder or an empty Optional if such a Feature is unknown to this builder.
        Parameters:
        featureId - the identifier of the Feature to be returned.
        Returns:
        the Feature with ID featureId or an empty Optional.
      • setAll

        FeaturesBuilder setAll​(java.lang.Iterable<Feature> features)
        Sets all given Features to this builder. Each previously set feature with the same ID is replaced.
        Parameters:
        features - the Features to be set.
        Returns:
        this builder to allow method chaining.
        Throws:
        java.lang.NullPointerException - if features is null.
      • remove

        FeaturesBuilder remove​(Feature feature)
        Removes the given Feature from this builder. Same like remove(String).
        Parameters:
        feature - the Feature to be removed.
        Returns:
        this builder to allow method chaining.
        Throws:
        java.lang.NullPointerException - if feature is null.
      • remove

        FeaturesBuilder remove​(java.lang.String featureId)
        Removes the Feature with the given ID from this builder.
        Parameters:
        featureId - the ID of the Feature to be removed.
        Returns:
        this builder to allow method chaining.
        Throws:
        java.lang.NullPointerException - if featureId is null.
      • removeAll

        FeaturesBuilder removeAll()
        Removes all previously set Features.
        Returns:
        this builder to allow method chaining.
      • build

        Features build()
        Creates a new Features object containing all features which were set to this builder beforehand.
        Returns:
        the new Features object.