Interface FeatureBuilder.FromCopyBuildable

  • Enclosing interface:
    FeatureBuilder

    @NotThreadSafe
    public static interface FeatureBuilder.FromCopyBuildable
    A mutable builder with a fluent API for an immutable Feature. This builder is initialised with the properties of an existing Feature.
    • Method Detail

      • definition

        FeatureBuilder.FromCopyBuildable definition​(@Nullable
                                                    FeatureDefinition featureDefinition)
        Sets the specified Definition to the Feature to be built.
        Parameters:
        featureDefinition - the Definition to be set or null.
        Returns:
        this builder to allow method chaining.
      • properties

        FeatureBuilder.FromCopyBuildable properties​(@Nullable
                                                    FeatureProperties properties)
        Sets the properties of the Feature.
        Parameters:
        properties - the properties of the Feature to be created or null.
        Returns:
        this builder to allow method chaining.
      • properties

        FeatureBuilder.FromCopyBuildable properties​(@Nullable
                                                    org.eclipse.ditto.json.JsonObject properties)
        Sets the properties of the Feature.
        Parameters:
        properties - the properties of the Feature to be created or null.
        Returns:
        this builder to allow method chaining.
      • properties

        FeatureBuilder.FromCopyBuildable properties​(java.util.function.Function<FeatureProperties,​FeatureProperties> transform)
        Calls the given transform function with the currently set properties of this builder. The result of the transform function is set as new properties of the Feature to be built.
        Parameters:
        transform - the function to transform the current properties of the Feature to be created. If there are no properties set yet, the function is called with empty properties.
        Returns:
        this builder to allow method chaining.
        Throws:
        java.lang.NullPointerException - if transform is null.
      • desiredProperties

        FeatureBuilder.FromCopyBuildable desiredProperties​(@Nullable
                                                           FeatureProperties desiredProperties)
        Sets the desired properties of the Feature.
        Parameters:
        desiredProperties - the desired properties of the Feature to be created or null.
        Returns:
        this builder to allow method chaining.
        Since:
        1.5.0
      • desiredProperties

        FeatureBuilder.FromCopyBuildable desiredProperties​(@Nullable
                                                           org.eclipse.ditto.json.JsonObject desiredProperties)
        Sets the desired properties of the Feature.
        Parameters:
        desiredProperties - the desired properties of the Feature to be created or null.
        Returns:
        this builder to allow method chaining.
        Since:
        1.5.0
      • desiredProperties

        FeatureBuilder.FromCopyBuildable desiredProperties​(java.util.function.UnaryOperator<FeatureProperties> transform)
        Calls the given transform function with the currently set desired properties of this builder. The result of the transform function is set as new desired properties of the Feature to be built.
        Parameters:
        transform - the function to transform the current desired properties of the Feature to be created. If there are no desired properties set yet, the function is called with empty desired properties.
        Returns:
        this builder to allow method chaining.
        Throws:
        java.lang.NullPointerException - if transform is null.
        Since:
        1.5.0
      • setId

        default FeatureBuilder.FromCopyBuildable setId​(java.lang.String featureId)
        Sets the given Feature ID to this builder.
        Parameters:
        featureId - the Feature ID to be set.
        Returns:
        this builder to allow method chaining.
        Throws:
        java.lang.NullPointerException - if featureId is null.
        java.lang.IllegalArgumentException - if featureId is empty.
      • setId

        FeatureBuilder.FromCopyBuildable setId​(java.util.function.Predicate<java.lang.String> existingIdPredicate,
                                               java.lang.String featureId)
        Sets the given Feature ID to this builder.
        Parameters:
        existingIdPredicate - a predicate to decide whether the given ID is set. The predicate receives the currently set Feature ID.
        featureId - the Feature ID to be set.
        Returns:
        this builder to allow method chaining.
        Throws:
        java.lang.NullPointerException - if any argument is null.
        java.lang.IllegalArgumentException - if featureId is empty.
      • build

        Feature build()
        Creates a new Feature object based on the data which was provided to this builder.
        Returns:
        a new Feature object.