Package com.microstrategy.web.platform
Class AbstractParameterBuilder
- java.lang.Object
-
- com.microstrategy.web.platform.AbstractParameterBuilder
-
- All Implemented Interfaces:
ParameterBuilder
- Direct Known Subclasses:
AbstractConfigurableParameterBuilder
public abstract class AbstractParameterBuilder extends java.lang.Object implements ParameterBuilder
An abstract implementation for ParameterBuilder which stores all information supplied, but is unable to convert it to a string. Each subclass implements the toString and the isEmpty methods.- Since:
- MicroStrategy Web 8.0.0
-
-
Field Summary
Fields Modifier and Type Field Description protected int_initialSizeThe initial size of the buffer to hold the ParameterBuilder contents...protected NamespaceEncoder_namespaceEncoderA storedNamespaceEncoderinstance which is managed by this class.protected Parameters_parametersAn array of key/value pairs that were added...protected java.lang.String_targetBaseThe Target Baseprotected java.lang.String_targetPrefixThe Target Prefixprotected java.lang.String_targetSuffixThe Target Suffix
-
Constructor Summary
Constructors Constructor Description AbstractParameterBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEventInfo(WebEvent event, int eventElements, int howMuchChildState)Adds into the current object the event information in the format of key/value pairs.voidaddParameter(java.lang.String name, java.lang.String value)Add a name/value pair.voidaddParameterUnique(java.lang.String name, java.lang.String value, boolean overwrite)DE191250: Unexpected behaviors when parameters are added multiple time by mistake Add a non-repeated unique key/value pair.static booleanareAllBitsSet(int intVal, int bits)Determines whether the specified integer value has set all its bits specified through the the parameterbits.NamespaceEncodergetNamespaceEncoder()The currentNamespaceEncoderassociated with this ParameterBuilder.java.util.IteratorgetParameters()Return an iterator for the list of parameters.java.lang.StringgetTargetBase()Returns the target base supplied to this ParameterBuilder viasetTargetBase(java.lang.String).java.lang.StringgetTargetPrefix()Returns the target prefix supplied to this ParameterBuilder viasetTargetPrefix(java.lang.String).java.lang.StringgetTargetSuffix()Returns the target suffix supplied to this ParameterBuilder viasetTargetSuffix(java.lang.String).voidinit(java.lang.Object parent)Initializes this class by attaching up a namespace encoder (as provided by the parent).static booleanisAnyBitSet(int intVal, int bits)Determines whether the specified integer value has set any bit specified through the the parameterbits.protected voidparseEntireURLStringFragment(java.lang.String fragment)This method parses a string fragment that is belived to contain an entire URL (base URI plus zero or more parameters).protected voidparseURLParameterFragment(java.lang.String fragment)This method parses a string fragment that is believed to contain only URL parameters ("...&key1=value1&...").voidsetInitialSize(int chars)The initial size of theParameterBuilderin number of characters.voidsetNamespaceEncoder(NamespaceEncoder nse)Assign the suppliedNamespaceEncoderto this ParameterBuilder instance.voidsetTargetBase(java.lang.String targetBase)Specify a target base URI (for URL generation).voidsetTargetPrefix(java.lang.String targetPrefix)Specifies a prefix string to appear before the Target Base.voidsetTargetSuffix(java.lang.String targetSuffix)Specifies a suffix string to appear after the Target Base.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.microstrategy.web.platform.ParameterBuilder
addFragment, isEmpty, toString
-
-
-
-
Field Detail
-
_namespaceEncoder
protected NamespaceEncoder _namespaceEncoder
A storedNamespaceEncoderinstance which is managed by this class.
-
_targetPrefix
protected java.lang.String _targetPrefix
The Target Prefix
-
_targetBase
protected java.lang.String _targetBase
The Target Base
-
_targetSuffix
protected java.lang.String _targetSuffix
The Target Suffix
-
_parameters
protected Parameters _parameters
An array of key/value pairs that were added...
-
_initialSize
protected int _initialSize
The initial size of the buffer to hold the ParameterBuilder contents...
-
-
Method Detail
-
init
public void init(java.lang.Object parent)
Initializes this class by attaching up a namespace encoder (as provided by the parent).- Specified by:
initin interfaceParameterBuilder- Parameters:
parent- The enclosing parent for this ParameterBuilder instance.
-
setInitialSize
public void setInitialSize(int chars)
The initial size of theParameterBuilderin number of characters.- Specified by:
setInitialSizein interfaceParameterBuilder- Parameters:
chars- A rough estimate of the total number of characters added in all key/value pairs.
-
getNamespaceEncoder
public NamespaceEncoder getNamespaceEncoder()
The currentNamespaceEncoderassociated with this ParameterBuilder.- Specified by:
getNamespaceEncoderin interfaceParameterBuilder- Returns:
- The
NamespaceEncoderassociated with this ParameterBuilder.
-
setNamespaceEncoder
public void setNamespaceEncoder(NamespaceEncoder nse)
Assign the suppliedNamespaceEncoderto this ParameterBuilder instance.- Specified by:
setNamespaceEncoderin interfaceParameterBuilder- Parameters:
nse- TheNamespaceEncoderinstance to use with this ParameterBuilder.
-
addParameter
public void addParameter(java.lang.String name, java.lang.String value)Add a name/value pair.- Specified by:
addParameterin interfaceParameterBuilder- Parameters:
name- The name of a WebEvent element.value- The value of a WebEvent element.
-
addParameterUnique
public void addParameterUnique(java.lang.String name, java.lang.String value, boolean overwrite)DE191250: Unexpected behaviors when parameters are added multiple time by mistake Add a non-repeated unique key/value pair.- Specified by:
addParameterUniquein interfaceParameterBuilder- 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
-
getTargetBase
public java.lang.String getTargetBase()
Returns the target base supplied to this ParameterBuilder viasetTargetBase(java.lang.String). If none was supplied, then this method returnsnull.- Specified by:
getTargetBasein interfaceParameterBuilder- Returns:
- The value supplied by the caller in the last call to
setTargetBase(java.lang.String). If never called, it returnsnull.
-
getTargetPrefix
public java.lang.String getTargetPrefix()
Returns the target prefix supplied to this ParameterBuilder viasetTargetPrefix(java.lang.String). If none was supplied, then this method returnsnull. 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.- Specified by:
getTargetPrefixin interfaceParameterBuilder- Returns:
- The value supplied by the caller in the last call to
setTargetPrefix(java.lang.String). If never called, it returnsnull.
-
getTargetSuffix
public java.lang.String getTargetSuffix()
Returns the target suffix supplied to this ParameterBuilder viasetTargetSuffix(java.lang.String). If none was supplied, then this method returnsnull.- Specified by:
getTargetSuffixin interfaceParameterBuilder- Returns:
- The value supplied by the caller in the last call to
setTargetSuffix(java.lang.String). If never called, it returnsnull.
-
setTargetBase
public 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 withsetTargetPrefix(java.lang.String)andsetTargetSuffix(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).- Specified by:
setTargetBasein interfaceParameterBuilder- 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)
-
setTargetPrefix
public 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.- Specified by:
setTargetPrefixin interfaceParameterBuilder- Parameters:
targetPrefix- A string to be prepended to the Target Base.- See Also:
setTargetBase(java.lang.String)
-
setTargetSuffix
public 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.- Specified by:
setTargetSuffixin interfaceParameterBuilder- Parameters:
targetSuffix- A string to be appended to the Target Base.- See Also:
setTargetBase(java.lang.String)
-
getParameters
public java.util.Iterator getParameters()
Return an iterator for the list of parameters.- Returns:
- An iterator on the supplied parameters.
-
parseURLParameterFragment
protected void parseURLParameterFragment(java.lang.String fragment)
This method parses a string fragment that is believed to contain only URL parameters ("...&key1=value1&..."). The fragment is first tokenized by the ampersand character (to yield a key/value pair separated by '='). Next, each pair is tokenized by the equals sign and broken into a key and value. Each pair is then saved usingaddParameter(java.lang.String, java.lang.String).- Parameters:
fragment- A string representing a set of URL parameters.
-
areAllBitsSet
public static boolean areAllBitsSet(int intVal, int bits)Determines whether the specified integer value has set all its bits specified through the the parameterbits.- Parameters:
intVal- an integer value whose bits to be checkedbits- the bits to check- Returns:
trueif all bits specified through the parameterbitsare set in the specified integer valueintVal.
-
isAnyBitSet
public static boolean isAnyBitSet(int intVal, int bits)Determines whether the specified integer value has set any bit specified through the the parameterbits.- Parameters:
intVal- an integer value whose bits to be checkedbits- the bits to check- Returns:
trueif any bit specified through the parameterbitsis set in the specified integer valueintVal.
-
addEventInfo
public void addEventInfo(WebEvent event, int eventElements, int howMuchChildState)
Adds into the current object the event information in the format of key/value pairs.- Specified by:
addEventInfoin interfaceParameterBuilder- Parameters:
event- the event whose information to be added.eventElements- A bit mask value composed of constants fromEnumEventElement. These determine what elements of the event is added.howMuchChildState- If children state is to be added, this parameter (whose values come fromEnumWebPersistableState) determines how much state.
-
parseEntireURLStringFragment
protected void parseEntireURLStringFragment(java.lang.String fragment)
This method parses a string fragment that is belived to contain an entire URL (base URI plus zero or more parameters). If the base URI is found (which is any non-empty string before the first '?' character), then it is added viasetTargetBase(java.lang.String). The remaining string is parsed viaparseURLParameterFragment(java.lang.String).- Parameters:
fragment- A string representing a complete URL.
-
-