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 Details

    • TRUE

      protected static final String TRUE
  • Constructor Details

    • AbstractBooleanUrlReadingCondition

      public AbstractBooleanUrlReadingCondition()
  • Method Details

    • init

      public void init(Map<String,String> params) throws com.atlassian.plugin.PluginParseException
      Description copied from interface: UrlReadingCondition
      Called after creation and autowiring.
      Specified by:
      init in interface UrlReadingCondition
      Parameters:
      params - The optional map of parameters specified in XML.
      Throws:
      com.atlassian.plugin.PluginParseException
    • addToUrl

      public void addToUrl(UrlBuilder urlBuilder)
      Description copied from interface: UrlReadingCondition
      Called 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:
      addToUrl in interface UrlReadingCondition
      Parameters:
      urlBuilder - interface for contributing to the URL
    • shouldDisplay

      public boolean shouldDisplay(QueryParams params)
      Description copied from interface: UrlReadingCondition
      Determine whether the web fragment should be displayed. This method should only read values from its config and the query params.
      Specified by:
      shouldDisplay in interface UrlReadingCondition
      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

      protected abstract String queryKey()
      Should be unique to avoid clashes
      Returns:
      the key to append to the query string