List of usage examples for com.google.common.base Strings emptyToNull
@Nullable public static String emptyToNull(@Nullable String string)
From source file:ezbake.groups.common.GroupNameHelper.java
public String addRootGroupPrefix(String unprefixed) { String prefixed = unprefixed; if (unprefixed == null || !unprefixed.startsWith(ROOT_PREFIX)) { prefixed = Joiner.on(EzGroupsConstants.GROUP_NAME_SEP).skipNulls().join(EzGroupsConstants.ROOT, Strings.emptyToNull(unprefixed)); }/*from w w w .j av a 2 s . co m*/ return prefixed; }
From source file:org.n52.shetland.ogc.ows.OwsLanguageString.java
public OwsLanguageString(String lang, String value) { this.lang = Strings.emptyToNull(lang); this.value = Objects.requireNonNull(Strings.emptyToNull(value)); }
From source file:org.impressivecode.depress.support.extmarkerparser.Configuration.java
public Configuration(final SettingsModelString regExpID, final SettingsModelString builder) { if (emptyToNull(regExpID.getStringValue()) != null) { this.idRegexp = Pattern.compile(regExpID.getStringValue(), Pattern.MULTILINE); } else {/* w w w .j av a 2 s . c o m*/ this.idRegexp = null; } this.builderFormat = Strings.emptyToNull(builder.getStringValue()); }
From source file:fathom.realm.FileRealm.java
@Override public void setup(Config config) { super.setup(config); String file = Strings.emptyToNull(config.getString("file")); Preconditions.checkNotNull(file, "The [file] setting must be set!"); File realmFile = new File(file); setFile(realmFile);/*from w w w. j av a2 s. c om*/ }
From source file:com.google.gerrit.server.project.ProjectJson.java
public ProjectInfo format(Project p) { ProjectInfo info = new ProjectInfo(); info.name = p.getName();//from w w w .j a v a 2 s. co m Project.NameKey parentName = p.getParent(allProjects); info.parent = parentName != null ? parentName.get() : null; info.description = Strings.emptyToNull(p.getDescription()); info.finish(); return info; }
From source file:org.lendingclub.mercator.docker.DockerEndpointMetadataImpl.java
public Optional<String> getSwarmId() { JsonNode n = supplier.getWebTarget().path("/info").request().get(JsonNode.class); return Optional.ofNullable(Strings.emptyToNull(n.path("Swarm").path("Cluster").path("ID").asText())); }
From source file:com.github.autermann.sockets.ssl.KeyStoreOptions.java
public KeyStoreOptions(String path, String pass, String type) { this.path = Preconditions.checkNotNull(path); this.pass = Preconditions.checkNotNull(pass); this.type = Objects.firstNonNull(Strings.emptyToNull(type), SSLConstants.KEYSTORE_TYPE_JKS); }
From source file:com.m3958.apps.pcms.filter.DomainAjaxFilter.java
/** * Select and set (if specified) the character encoding to be used to interpret request parameters * for this request./*from ww w.j av a 2s . c o m*/ * * @param request The servlet request we are processing * @param result The servlet response we are creating * @param chain The filter chain we are processing * * @exception IOException if an input/output error occurs * @exception ServletException if a servlet error occurs */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; String xhrh = Strings.emptyToNull(req.getParameter("_isxhr")); if (xhrh != null) { String newurl = req.getRequestURI() + "?_isxhr=true";// dispatcher uriquerystring ?? req.getRequestDispatcher(newurl).forward(request, response); } else { xhrh = Strings.emptyToNull(req.getHeader("X-Requested-With")); if (xhrh != null && "XMLHttpRequest".equals(xhrh)) {// it's does ajax request,so we add _isxhr // to parameters. String newurl = req.getRequestURI() + "?_isxhr=true"; req.getRequestDispatcher(newurl).forward(request, response); } else { chain.doFilter(request, response); } } }
From source file:org.n52.shetland.ogc.ows.OwsOperation.java
public OwsOperation(String name, Collection<OwsDomain> parameters, Collection<OwsDomain> constraints, Collection<OwsMetadata> metadata, Collection<OwsDCP> dcp) { this.name = Objects.requireNonNull(Strings.emptyToNull(name)); this.parameters = CollectionHelper.newSortedSet(parameters); this.constraints = CollectionHelper.newSortedSet(constraints); this.metadata = CollectionHelper.newSortedSet(metadata); this.dcp = CollectionHelper.newSortedSet(dcp); }
From source file:com.google.gerrit.server.project.GetProject.java
@Override public Object apply(ProjectResource resource) { Project project = resource.getControl().getProject(); ProjectInfo info = new ProjectInfo(); info.name = resource.getName();//from w w w . j a v a 2s. c om Project.NameKey parentName = project.getParent(allProjects); info.parent = parentName != null ? parentName.get() : null; info.description = Strings.emptyToNull(project.getDescription()); info.finish(); return info; }