Interface FeaturesBuilder

All Superinterfaces:
Iterable<Feature>

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

    • 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:
      NullPointerException - if feature is null.
    • get

      Optional<Feature> get(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(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:
      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:
      NullPointerException - if feature is null.
    • remove

      FeaturesBuilder remove(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:
      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.