List of usage examples for com.google.common.base Strings nullToEmpty
public static String nullToEmpty(@Nullable String string)
From source file:com.rapid7.conqueso.client.PropertyDefinition.java
@JsonCreator public PropertyDefinition(@JsonProperty("name") String name, @JsonProperty("type") PropertyType type, @JsonProperty("value") @Nullable String value) { checkArgument(!Strings.isNullOrEmpty(name), "name"); this.name = name; this.type = checkNotNull(type, "type"); this.value = Strings.nullToEmpty(value); }
From source file:com.skcraft.launcher.model.modpack.Manifest.java
@JsonIgnore public URL getLibrariesUrl() { if (Strings.nullToEmpty(getLibrariesLocation()) == null) { return null; }/*from w w w . j av a 2 s .co m*/ try { return LauncherUtils.concat(baseUrl, Strings.nullToEmpty(getLibrariesLocation()) + "/"); } catch (MalformedURLException e) { throw new RuntimeException(e); } }
From source file:com.google.testing.security.firingrange.tests.reflected.ContentSniffing.java
@Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { String echoedParam = Strings.nullToEmpty(request.getParameter(ECHOED_PARAM)); echoedParam = echoedParam.replace("\"", "\\\""); String template = Templates.getTemplate("json.tmpl", getClass()); String testType = Splitter.on('/').splitToList(request.getPathInfo()).get(1); String contentType;/*from ww w. ja va2 s . c o m*/ switch (testType) { case "json": contentType = "application/json"; break; case "plaintext": contentType = "text/plain"; break; default: throw new IllegalArgumentException(); } Responses.sendXssed(response, Templates.replacePayload(template, echoedParam), contentType); }
From source file:com.android.tools.idea.npw.template.components.ParameterComponentProvider.java
@NotNull @Override//from w w w . ja v a2s . c om public final T createComponent() { T component = createComponent(myParameter); component.setToolTipText(WizardUtils.toHtmlString(Strings.nullToEmpty(myParameter.help))); return component; }
From source file:com.capitaltg.bbcodeguard.hooks.PostMergePublishHook.java
@Override public void postReceive(RepositoryHookContext context, Collection<RefChange> changes) { try {/* w w w .j a v a 2s . c o m*/ String regexToPublish = Strings.nullToEmpty(context.getSettings().getString("regexToPublish")); Set<String> branchesToPublish = changes.stream().map(c -> c.getRef().getDisplayId()) .filter(c -> Pattern.matches(regexToPublish, c)).collect(Collectors.toSet()); branchesToPublish.stream() .forEach(branch -> jenkinsManager.startPublishJob(context.getRepository(), branch)); } catch (Exception e) { logger.error("TODO Failed to invoke publish after pull request merge", e); } }
From source file:com.googlesource.gerrit.plugins.hooks.workflow.action.AddStandardComment.java
private String formatPerson(String prefix, Map<String, String> map) { String ret = Strings.nullToEmpty(map.get(prefix + "-name")); if (ret.isEmpty()) { ret = Strings.nullToEmpty(map.get(prefix + "-username")); }/* www. ja va 2s .c o m*/ return ret; }
From source file:org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth.ClaimBuilder.java
public ClaimBuilder setClientId(String clientId) { this.clientId = Strings.nullToEmpty(clientId).trim(); return this; }
From source file:com.b2international.snowowl.identity.domain.Permission.java
/** * @param permissionId//from w ww .j a v a 2 s. c o m * application specific permission id. * @param name * A human readable representation of the application specific * permission. */ public Permission(final String permissionId, final String name) { this.id = checkNotNull(permissionId, "permissionId"); this.name = Strings.nullToEmpty(name); }
From source file:com.github.cassandra.jdbc.CassandraCqlStatement.java
public CassandraCqlStatement(String cql, CassandraCqlStmtConfiguration config, Object... params) { this.cql = Strings.nullToEmpty(cql); this.config = config; this.parameters = new Object[params == null ? 0 : params.length]; if (params != null) { int index = 0; for (Object p : params) { this.parameters[index++] = p; }// w ww . j a va 2s.com } }
From source file:org.splevo.diffing.util.NormalizationUtil.java
/** * Normalize a name space string (with '.' separators). * * @param namespace//w w w .j a v a 2s . c om * The original name space to normalize. * @param normalizations * The list of normalizations to apply. * @return The normalized name space string. */ public static String normalizeNamespace(String namespace, LinkedHashMap<Pattern, String> normalizations) { namespace = Strings.nullToEmpty(namespace); for (Pattern pattern : normalizations.keySet()) { String replacement = normalizations.get(pattern); namespace = pattern.matcher(namespace).replaceAll(replacement); } return namespace; }