java.lang.Object
com.sonyericsson.hudson.plugins.gerrit.trigger.utils.StringUtil

public final class StringUtil extends Object
Various string making utility methods.
Author:
Robert Sandell <robert.sandell@sonyericsson.com>
  • Field Details

    • REFSPEC_PREFIX

      public static final String REFSPEC_PREFIX
      What comes before the change and patch numbers in a refspec.
      See Also:
    • PLUGIN_URL

      public static final String PLUGIN_URL
      The base URL of this plugin. Only valid for web resources.
      See Also:
    • PLUGIN_IMAGES_URL

      public static final String PLUGIN_IMAGES_URL
      The base URL of the plugin images.
      See Also:
    • PLUGIN_JS_URL

      public static final String PLUGIN_JS_URL
      The base URL of the plugin javascripts.
      See Also:
  • Method Details

    • makeRefSpec

      public static String makeRefSpec(com.sonymobile.tools.gerrit.gerritevents.dto.events.ChangeBasedEvent event)
      Creates a refspec string from the data in the event. Unless the patch-set already has a refspec specified. For a change with number 3456 and patchset 1 the refspec would be refs/changes/56/3456/1
      Parameters:
      event - the event.
      Returns:
      the refspec.
      See Also:
      • ChangeBasedEvent.getPatchSet()
      • PatchSet.getRef()
    • getPluginImageUrl

      public static String getPluginImageUrl(String imageName)
      Gets the path to the provided image inside this plugin. The path returned is "compliant" with what for example Action.getIconFileName() expects.
      Parameters:
      imageName - the fileName of the image.
      Returns:
      the full path to the image.
      See Also:
    • getPluginJsUrl

      public static String getPluginJsUrl(String jsName)
      Gets the path to the provided javascript file inside this plugin.
      Parameters:
      jsName - the name if the javascript.
      Returns:
      the full path to the file.
      See Also:
    • escapeQuotes

      public static String escapeQuotes(String value)
      Escape quotes in String value.
      Parameters:
      value - the name of String object having quotes.
      Returns:
      String object as the result of escape quotes in input.
    • getDefaultDisplayNameForSpecificServer

      public static String getDefaultDisplayNameForSpecificServer(com.sonymobile.tools.gerrit.gerritevents.GerritEventListener listener, String serverName)
      Helper method for NamedGerritEventListeners. To display a consistent "Server: Simple Name" pattern. Usable by Diagnostics.
      Parameters:
      listener - the listener to get the class name from
      serverName - the name of the server to get the server's display name from, null or empty string produces "Any Server"
      Returns:
      the name to display.