Interface ParameterBuilder

  • All Known Implementing Classes:
    AbstractConfigurableParameterBuilder, AbstractParameterBuilder, DefaultHiddenInputBuilderImpl, DefaultURIBuilderImpl

    public interface ParameterBuilder
    This defines the interface between the WebEvent and the format that its content are persisted. For example, the contents of a WebEvent include:
    • The numeric event ID
    • The source of the event (a path from the root to the WebComponent)
    • A list of arguments that pertain to the event
    • A serialized set of states for all WebComponents
    All or any of these elements can be serialized into one of several different forms. The two most common forms are:
    • As a URL
    • As a set of hidden input (used in the context of a larger FORM
    This interface defines the minimum information that a WebEvent sends to persist an element of WebEvent information. Each different implementation of ParameterBuilder will choose to how to persist each name/value pair.
    Since:
    MicroStrategy Web 8.0.0
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addEventInfo​(WebEvent event, int eventElements, int howMuchChildState)
      Add the event information, which is represented in key/value pairs.
      void addFragment​(java.lang.String fragment)
      Add a fragment of key/value pairs.
      void addParameter​(java.lang.String name, java.lang.String value)
      Add a name/value pair.
      void addParameterUnique​(java.lang.String name, java.lang.String value, boolean overwrite)
      Add a non-repeated unique key/value pair.
      NamespaceEncoder getNamespaceEncoder()
      Each ParameterBuilder instance is associated with a NamespaceEncoder instance that is may choose to use for encoding a namespace into the output form.
      java.lang.String getTargetBase()
      Returns the target base supplied to this ParameterBuilder via setTargetBase(java.lang.String).
      java.lang.String getTargetPrefix()
      Returns the target prefix supplied to this ParameterBuilder via setTargetPrefix(java.lang.String).
      java.lang.String getTargetSuffix()
      Returns the target suffix supplied to this ParameterBuilder via setTargetSuffix(java.lang.String).
      void init​(java.lang.Object parent)
      Initialize this object (supplying the parent object as the only parameter).
      boolean isEmpty()
      This method returns true if no target base was added nor any parameters.
      void setInitialSize​(int chars)
      Set the initial size for this ParameterBuilder object.
      void setNamespaceEncoder​(NamespaceEncoder nse)
      This method can be used to set the NamespaceEncoder object used with this ParameterBuilder instance.
      void setTargetBase​(java.lang.String targetBase)
      Specify a target base URI (for URL generation).
      void setTargetPrefix​(java.lang.String targetPrefix)
      Specifies a prefix string to appear before the Target Base.
      void setTargetSuffix​(java.lang.String targetSuffix)
      Specifies a suffix string to appear after the Target Base.
      java.lang.String toString()
      Get the entire collection of parameters as a string.
    • Method Detail

      • init

        void init​(java.lang.Object parent)
        Initialize this object (supplying the parent object as the only parameter).
        Parameters:
        parent - The parent (enclosing) object that this Parameter Builder is attached to.
      • getNamespaceEncoder

        NamespaceEncoder getNamespaceEncoder()
        Each ParameterBuilder instance is associated with a NamespaceEncoder instance that is may choose to use for encoding a namespace into the output form. This method returns that object instance.
        Returns:
        The NamespaceEncoder instance associated with this ParameterBuilder.
      • setNamespaceEncoder

        void setNamespaceEncoder​(NamespaceEncoder nse)
        This method can be used to set the NamespaceEncoder object used with this ParameterBuilder instance.
        Parameters:
        nse - The NamespaceEncoder object to be used with this ParameterBuilder.
      • setInitialSize

        void setInitialSize​(int chars)
        Set the initial size for this ParameterBuilder object. Each implementation may choose to use this method to efficiently size the ParameterBuilder to support a set of key/value pairs whose total number of characters is supplied as the input parameter.
        Parameters:
        chars - A rough estimate of the total number of key/value characters to be submitted by the caller.
      • getTargetBase

        java.lang.String getTargetBase()
        Returns the target base supplied to this ParameterBuilder via setTargetBase(java.lang.String). If none was supplied, then this method returns null.
        Returns:
        The value supplied by the caller in the last call to setTargetBase(java.lang.String). If never called, it returns null.
      • setTargetBase

        void setTargetBase​(java.lang.String targetBase)
        Specify a target base URI (for URL generation). In the event that this ParameterBuilder is used to build a URI, then the supplied string should be used as the base URI (with all key/value pairs added after an initial '?'). This method works in conjunction with setTargetPrefix(java.lang.String) and setTargetSuffix(java.lang.String). When a string form of the ParameterBuilder object is requested (via #toString), then targetURI (if present) is added to the string along with a prefix or suffix. If a target was not supplied, then neither prefix or suffix will be added to the string (even if they are non-empty).
        Parameters:
        targetBase - The base URI to be used for this set of key/value pairs.
        See Also:
        setTargetPrefix(java.lang.String), setTargetSuffix(java.lang.String)
      • getTargetPrefix

        java.lang.String getTargetPrefix()
        Returns the target prefix supplied to this ParameterBuilder via setTargetPrefix(java.lang.String). If none was supplied, then this method returns null. A prefix is often to use to prepend an absolute path to a relative one. If supplied, it will be added directly before the target base.
        Returns:
        The value supplied by the caller in the last call to setTargetPrefix(java.lang.String). If never called, it returns null.
      • setTargetPrefix

        void setTargetPrefix​(java.lang.String targetPrefix)
        Specifies a prefix string to appear before the Target Base. A prefix is often to use to prepend an absolute path to a relative one. If supplied, it will be added directly before the target base (without any other characters). This string is not added if the TargetBase has not been explicitly set.
        Parameters:
        targetPrefix - A string to be prepended to the Target Base.
        See Also:
        setTargetBase(java.lang.String)
      • getTargetSuffix

        java.lang.String getTargetSuffix()
        Returns the target suffix supplied to this ParameterBuilder via setTargetSuffix(java.lang.String). If none was supplied, then this method returns null.
        Returns:
        The value supplied by the caller in the last call to setTargetSuffix(java.lang.String). If never called, it returns null.
      • setTargetSuffix

        void setTargetSuffix​(java.lang.String targetSuffix)
        Specifies a suffix string to appear after the Target Base. A suffix is often to use to append extra path information or extra parameters (e.g., ";key=value"). If supplied, it will be added directly after the target base (without any other characters). This string is not added if the TargetBase has not been explicitly set.
        Parameters:
        targetSuffix - A string to be appended to the Target Base.
        See Also:
        setTargetBase(java.lang.String)
      • addParameter

        void addParameter​(java.lang.String name,
                          java.lang.String value)
        Add a name/value pair.
        Parameters:
        name - The name of a WebEvent element.
        value - The value of a WebEvent element.
      • addParameterUnique

        void addParameterUnique​(java.lang.String name,
                                java.lang.String value,
                                boolean overwrite)
        Add a non-repeated unique key/value pair.
        Parameters:
        name - The name of a WebEvent element.
        value - The value of a WebEvent element.
        overwrite - Whether to overwrite the value when the key is already in the WebEvent Parameters
      • addFragment

        void addFragment​(java.lang.String fragment)
        Add a fragment of key/value pairs. This method is discouraged as it requires parsing of the incoming string fragment. It is preferable to use addParameter(java.lang.String, java.lang.String). It is the responsibility of each ParameterBuilder implementation to determine how to parse this fragment.
        Parameters:
        fragment - A string fragment which must be parsed for a sequence of key/value pairs.
      • isEmpty

        boolean isEmpty()
        This method returns true if no target base was added nor any parameters. It is not related to whether a target prefix/suffix was added. It is identical to asking whether the returned string (if requested now) would return empty or not.
        Returns:
        Whether the ParameterBuilder object is essentially empty or not.
      • addEventInfo

        void addEventInfo​(WebEvent event,
                          int eventElements,
                          int howMuchChildState)
        Add the event information, which is represented in key/value pairs.
        Parameters:
        event - the event to add.
        eventElements - A bit mask value composed of constants from EnumEventElement. These determine what elements of the event is added.
        howMuchChildState - If children state is to be added, this parameter (whose values come from * EnumWebPersistableState) determines how much state.
      • toString

        java.lang.String toString()
        Get the entire collection of parameters as a string.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation of the set of key/value pairs. EnumWebPersistableState) determines how much state.