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

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

Introduction

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

Prototype

@Nullable
public static String emptyToNull(@Nullable String string) 

Source Link

Document

Returns the given string if it is nonempty; null otherwise.

Usage

From source file:org.apache.isis.core.metamodel.facets.actions.layout.CssClassFaFacetOnActionFromLayoutProperties.java

private static String cssClassFa(final Properties properties) {
    if (properties == null) {
        return null;
    }//  w w w  .  j a v  a 2s.co  m
    return Strings.emptyToNull(properties.getProperty("cssClassFa"));
}

From source file:io.druid.query.extraction.IdentityExtractionFn.java

@Override
public String apply(Object value) {
    return value == null ? null : Strings.emptyToNull(value.toString());
}

From source file:it.anyplace.sync.client.protocol.rp.beans.SessionInvitation.java

private SessionInvitation(String from, String key, InetAddress address, int port, boolean isServerSocket) {
    checkNotNull(Strings.emptyToNull(from));
    checkNotNull(Strings.emptyToNull(key));
    checkNotNull(address);//  ww  w  .  ja v  a2  s . c  om
    this.from = from;
    this.key = key;
    this.address = address;
    this.port = port;
    this.isServerSocket = isServerSocket;
}

From source file:org.apache.james.jmap.utils.DownloadPath.java

private static Optional<String> name(List<String> pathVariables) {
    return Optional.ofNullable(Strings.emptyToNull(Iterables.get(pathVariables, 2, null)));
}

From source file:com.facebook.buck.parser.ParseContext.java

/**
 * Used when parsing target names relative to another target, such as in a build file.
 * @param baseName name such as {@code //first-party/orca}
 *///  w  w  w.  ja v  a2 s. c o m
public static ParseContext forBaseName(String baseName) {
    Preconditions.checkNotNull(Strings.emptyToNull(baseName));
    return new ParseContext(Type.BUILD_FILE, baseName);
}

From source file:org.n52.shetland.ogc.ows.OwsServiceProvider.java

public OwsServiceProvider(String providerName, OwsOnlineResource providerSite,
        OwsResponsibleParty serviceContact) {
    this.providerName = Objects.requireNonNull(Strings.emptyToNull(providerName));
    this.providerSite = Optional.ofNullable(providerSite);
    this.serviceContact = Objects.requireNonNull(serviceContact);
}

From source file:org.killbill.billing.plugin.analytics.BusinessExecutor.java

@VisibleForTesting
static int getNbThreads(OSGIConfigPropertiesService osgiConfigPropertiesService) {
    final String nbThreadsMaybeNull = Strings
            .emptyToNull(osgiConfigPropertiesService.getString(ANALYTICS_REFRESH_NB_THREADS_PROPERTY));
    return nbThreadsMaybeNull == null ? 100 : Integer.valueOf(nbThreadsMaybeNull);
}

From source file:com.google.gerrit.pgm.init.JDBCInitializer.java

private void guessDriver(Section database) {
    String url = Strings.emptyToNull(database.get("url"));
    if (url != null && Strings.isNullOrEmpty(database.get("driver"))) {
        if (url.startsWith("jdbc:h2:")) {
            database.set("driver", "org.h2.Driver");
        } else if (url.startsWith("jdbc:mysql:")) {
            database.set("driver", "com.mysql.jdbc.Driver");
        } else if (url.startsWith("jdbc:postgresql:")) {
            database.set("driver", "org.postgresql.Driver");
        }//w w w. j  av a2  s  .c o m
    }
}

From source file:org.apache.isis.core.metamodel.facets.actions.layout.NamedFacetOnActionFromLayoutProperties.java

private static boolean namedEscaped(Properties properties) {
    boolean escaped = true;
    if (properties != null) {
        String namedEscapedValue = Strings.emptyToNull(properties.getProperty("namedEscaped"));
        if ("false".equalsIgnoreCase(namedEscapedValue)) {
            escaped = false;/*from w w w . j  a  v a 2 s .  co m*/
        }
    }
    return escaped;
}

From source file:org.apache.isis.core.metamodel.facets.collections.layout.NamedFacetOnCollectionFromLayoutProperties.java

private static boolean namedEscaped(final Properties properties) {
    boolean escaped = true;
    if (properties != null) {
        String namedEscapedValue = Strings.emptyToNull(properties.getProperty("namedEscaped"));
        if ("false".equalsIgnoreCase(namedEscapedValue)) {
            escaped = false;/*from w w  w  . ja v a2  s.c om*/
        }
    }
    return escaped;
}