Class ValueBuilder

java.lang.Object
org.mule.sdk.api.values.ValueBuilder

@MinMuleVersion("4.4") @DoNotEnforceMinMuleVersion public class ValueBuilder extends Object
An implementation of the builder design pattern to create a new ValueBuilder instance.
Since:
1.0
  • Method Details

    • newValue

      public static ValueBuilder newValue(String id)
      Creates and returns new instance of a ValueBuilder, to help building a new Value represented by the given
      Parameters:
      id - of the Value to be created
      Returns:
      an initialized instance of ValueBuilder
    • newValue

      public static ValueBuilder newValue(String id, String partName)
      Creates and returns new instance of a ValueBuilder, to help building a new Value represented by the given
      Parameters:
      id - of the Value to be created
      partName - the name of the part
      Returns:
      an initialized instance of ValueBuilder
    • getValuesFor

      public static Set<Value> getValuesFor(String... values)
      Utility to create single level values from an array of Strings.
      Parameters:
      values - array of strings to be converted to Value
      Returns:
      a Set of Value based on the given values
    • getValuesFor

      public static Set<Value> getValuesFor(List<String> values)
      Utility to create single level values from an List of Strings.
      Parameters:
      values - list of strings to be converted to Value
      Returns:
      a Set of Value based on the given values
    • getValuesFor

      public static Set<Value> getValuesFor(Stream<String> values)
      Utility to create single level values from an Stream of Strings.
      Parameters:
      values - stream of strings to be converted to Value
      Returns:
      a Set of Value based on the given values
    • getValuesFor

      public static Set<Value> getValuesFor(Map<String,String> values)
      Utility to create single level values from an Map of Strings to Strings. The key of the Map will be considered as the id and the value as display name
      Parameters:
      values - array of strings to be converted to Value
      Returns:
      a Set of Value based on the given values
    • withDisplayName

      public ValueBuilder withDisplayName(String displayName)
      Adds a display name to the Value that is being built
      Parameters:
      displayName - of the Value to be created
      Returns:
      this builder with the configured display name
    • withChild

      public ValueBuilder withChild(ValueBuilder valueBuilder)
      Adds a new ValueBuilder child to the Value that is being built.
      Parameters:
      valueBuilder - the ValueBuilder that is used to create the instance of the new child.
      Returns:
      this builder with a new child.
    • setPartName

      protected void setPartName(String partName)
    • build

      public Value build()
      Create an Value based in the information given to the Builder, included all their children.
      Returns:
      the built Value