Example usage for com.google.common.base Strings nullToEmpty

List of usage examples for com.google.common.base Strings nullToEmpty

Introduction

In this page you can find the example usage for com.google.common.base Strings nullToEmpty.

Prototype

public static String nullToEmpty(@Nullable String string) 

Source Link

Document

Returns the given string if it is non-null; the empty string otherwise.

Usage

From source file:org.robotframework.ide.eclipse.main.plugin.views.execution.ExecutionTreeNode.java

String getMessage() {
    return Strings.nullToEmpty(message);
}

From source file:fr.da2i.lup1.entity.security.Credential.java

@Override
public String getId() {
    return Strings.nullToEmpty(login);
}

From source file:edu.buaa.satla.analysis.cfa.ast.ASimpleDeclarations.java

@Override
public String toASTString() {
    String name = Strings.nullToEmpty(getName());
    return getType().toASTString(name) + ";";
}

From source file:net.minecraftforge.client.event.ClientChatEvent.java

public ClientChatEvent(String message) {
    this.setMessage(message);
    this.originalMessage = Strings.nullToEmpty(message);
}

From source file:com.google.gitiles.RepositoryIndexServlet.java

@VisibleForTesting
Map<String, ?> buildData(HttpServletRequest req) throws IOException {
    RepositoryDescription desc = accessFactory.forRequest(req).getRepositoryDescription();
    return ImmutableMap.of("cloneUrl", desc.cloneUrl, "description", Strings.nullToEmpty(desc.description),
            "branches", getRefs(req, Constants.R_HEADS), "tags", getRefs(req, Constants.R_TAGS));
}

From source file:org.gradle.api.publish.maven.internal.artifact.AbstractMavenArtifact.java

public final void setClassifier(String classifier) {
    this.classifier = Strings.nullToEmpty(classifier);
}

From source file:org.gradle.api.publish.ivy.internal.artifact.AbstractIvyArtifact.java

@Override
public void setType(String type) {
    this.type = Strings.nullToEmpty(type);
}

From source file:org.eclipse.mylyn.internal.tasks.ui.editors.LabelsAttributeEditor.java

public static List<String> getTrimmedValues(String[] values) {
    return FluentIterable.from(Arrays.asList(values)).transform(new Function<String, String>() {
        @Override/*from ww  w  . j a va 2s  .com*/
        public String apply(String input) {
            return Strings.nullToEmpty(input).trim();
        }
    }).filter(new Predicate<String>() {
        @Override
        public boolean apply(String input) {
            return !Strings.isNullOrEmpty(input);
        }
    }).toList();
}

From source file:com.b2international.commons.SystemUtils.java

private static String getOsSafe() {
    return Strings.nullToEmpty(getProperty(OS_NAME));
}

From source file:gobblin.util.filesystem.FileSystemKey.java

private URI resolveURI(URI uri, Configuration configuration) {
    String scheme = uri.getScheme();
    String authority = uri.getAuthority();

    if (scheme == null && authority == null) { // use default FS
        return FileSystem.getDefaultUri(configuration);
    }//  w  w  w .ja v a2s.  com

    if (scheme != null && authority == null) { // no authority
        URI defaultUri = FileSystem.getDefaultUri(configuration);
        if (scheme.equals(defaultUri.getScheme()) // if scheme matches default
                && defaultUri.getAuthority() != null) { // & default has authority
            return defaultUri; // return default
        }
    }

    try {
        return new URI(scheme, Strings.nullToEmpty(authority), "/", null, null);
    } catch (URISyntaxException use) {
        // This should never happen
        throw new RuntimeException(use);
    }
}