Class StringUtil
java.lang.Object
com.sonyericsson.hudson.plugins.gerrit.trigger.utils.StringUtil
Various string making utility methods.
- Author:
- Robert Sandell <robert.sandell@sonyericsson.com>
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringescapeQuotes(String value) Escape quotes in String value.static StringgetDefaultDisplayNameForSpecificServer(com.sonymobile.tools.gerrit.gerritevents.GerritEventListener listener, String serverName) Helper method forNamedGerritEventListeners.static StringgetPluginImageUrl(String imageName) Gets the path to the provided image inside this plugin.static StringgetPluginJsUrl(String jsName) Gets the path to the provided javascript file inside this plugin.static StringmakeRefSpec(com.sonymobile.tools.gerrit.gerritevents.dto.events.ChangeBasedEvent event) Creates a refspec string from the data in the event.
-
Field Details
-
REFSPEC_PREFIX
What comes before the change and patch numbers in a refspec.- See Also:
-
PLUGIN_URL
The base URL of this plugin. Only valid for web resources.- See Also:
-
PLUGIN_IMAGES_URL
The base URL of the plugin images.- See Also:
-
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
Gets the path to the provided image inside this plugin. The path returned is "compliant" with what for exampleAction.getIconFileName()expects.- Parameters:
imageName- the fileName of the image.- Returns:
- the full path to the image.
- See Also:
-
getPluginJsUrl
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
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 forNamedGerritEventListeners. To display a consistent "Server: Simple Name" pattern. Usable byDiagnostics.- Parameters:
listener- the listener to get the class name fromserverName- 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.
-