Class StringUtil
- 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 Summary
Fields Modifier and Type Field Description static String
PLUGIN_IMAGES_URL
The base URL of the plugin images.static String
PLUGIN_JS_URL
The base URL of the plugin javascripts.static String
PLUGIN_URL
The base URL of this plugin.static String
REFSPEC_PREFIX
What comes before the change and patch numbers in a refspec.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
escapeQuotes(String value)
Escape quotes in String value.static String
getDefaultDisplayNameForSpecificServer(com.sonymobile.tools.gerrit.gerritevents.GerritEventListener listener, String serverName)
Helper method forNamedGerritEventListener
s.static String
getPluginImageUrl(String imageName)
Gets the path to the provided image inside this plugin.static String
getPluginJsUrl(String jsName)
Gets the path to the provided javascript file inside this plugin.static String
makeRefSpec(com.sonymobile.tools.gerrit.gerritevents.dto.events.ChangeBasedEvent event)
Creates a refspec string from the data in the event.
-
-
-
Field Detail
-
REFSPEC_PREFIX
public static final String REFSPEC_PREFIX
What comes before the change and patch numbers in a refspec.- See Also:
- Constant Field Values
-
PLUGIN_URL
public static final String PLUGIN_URL
The base URL of this plugin. Only valid for web resources.- See Also:
- Constant Field Values
-
PLUGIN_IMAGES_URL
public static final String PLUGIN_IMAGES_URL
The base URL of the plugin images.- See Also:
- Constant Field Values
-
PLUGIN_JS_URL
public static final String PLUGIN_JS_URL
The base URL of the plugin javascripts.- See Also:
- Constant Field Values
-
-
Method Detail
-
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 exampleAction.getIconFileName()
expects.- Parameters:
imageName
- the fileName of the image.- Returns:
- the full path to the image.
- See Also:
PLUGIN_IMAGES_URL
-
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:
PLUGIN_JS_URL
-
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 forNamedGerritEventListener
s. 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.
-
-