Class AbstractBooleanUrlReadingCondition
java.lang.Object
com.atlassian.webresource.spi.condition.AbstractBooleanUrlReadingCondition
- All Implemented Interfaces:
UrlReadingCondition
public abstract class AbstractBooleanUrlReadingCondition
extends Object
implements UrlReadingCondition
Simple abstract implementation for
UrlReadingCondition implementations.
Handles encoding a single boolean into the url. The convention here is that if the condition is true, it is added the querystring; if false it is not added to the querystring.
- Since:
- 6.3.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToUrl(UrlBuilder urlBuilder) Called when constructing the URL as the hosting HTML page is being served.voidCalled after creation and autowiring.protected abstract booleanprotected abstract StringqueryKey()Should be unique to avoid clashesbooleanshouldDisplay(QueryParams params) Determine whether the web fragment should be displayed.
-
Field Details
-
TRUE
-
-
Constructor Details
-
AbstractBooleanUrlReadingCondition
public AbstractBooleanUrlReadingCondition()
-
-
Method Details
-
init
Description copied from interface:UrlReadingConditionCalled after creation and autowiring.- Specified by:
initin interfaceUrlReadingCondition- Parameters:
params- The optional map of parameters specified in XML.- Throws:
com.atlassian.plugin.PluginParseException
-
addToUrl
Description copied from interface:UrlReadingConditionCalled when constructing the URL as the hosting HTML page is being served. Can add parameters to the query string and alter the resource hash.- Specified by:
addToUrlin interfaceUrlReadingCondition- Parameters:
urlBuilder- interface for contributing to the URL
-
shouldDisplay
Description copied from interface:UrlReadingConditionDetermine whether the web fragment should be displayed. This method should only read values from its config and the query params.- Specified by:
shouldDisplayin interfaceUrlReadingCondition- Parameters:
params- query params- Returns:
- true if the user should see the fragment, false otherwise
-
isConditionTrue
protected abstract boolean isConditionTrue()- Returns:
- true if this condition passes. This is evaluated at url generation time.
-
queryKey
Should be unique to avoid clashes- Returns:
- the key to append to the query string
-