Class ConfigPayloadBuilder


  • public class ConfigPayloadBuilder
    extends java.lang.Object
    Helper class for building Slime config payloads, while supporting referring to payloads with their indices. The builder does not care about config field types. This is resolved by the actual config type consumer created from the Slime tree. TODO: Add toString
    Author:
    Ulf Lilleengen
    • Constructor Detail

      • ConfigPayloadBuilder

        public ConfigPayloadBuilder()
        Construct a payload builder that is not a leaf.
      • ConfigPayloadBuilder

        public ConfigPayloadBuilder​(ConfigDefinition configDefinition)
      • ConfigPayloadBuilder

        public ConfigPayloadBuilder​(ConfigPayload payload)
    • Method Detail

      • setField

        public void setField​(java.lang.String name,
                             java.lang.String value)
        Set the value of a config field.
        Parameters:
        name - Name of the config field.
        value - Value of the config field.
      • getObject

        public ConfigPayloadBuilder getObject​(java.lang.String name)
        Get a new payload builder for a config struct, which can be used to add inner values to that struct.
        Parameters:
        name - Name of the struct to create.
        Returns:
        A payload builder corresponding to the name.
      • getArray

        public ConfigPayloadBuilder.Array getArray​(java.lang.String name)
        Create a new array where new values may be added.
        Parameters:
        name - Name of array.
        Returns:
        Array object supporting adding elements to it.
      • resolve

        public void resolve​(com.yahoo.slime.Cursor parent)
        Create slime tree from this builder.
        Parameters:
        parent - the parent Cursor for this builder
      • getValue

        public java.lang.String getValue()
        Get the value of this field, if any.
        Returns:
        value of field, null if this is not a leaf.
      • setValue

        public void setValue​(java.lang.String value)
      • getMap

        public ConfigPayloadBuilder.MapBuilder getMap​(java.lang.String name)
        Create a new map where new values may be added.
        Parameters:
        name - Name of map.
        Returns:
        Map builder supporting adding elements to it.