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:fr.ens.biologie.genomique.eoulsan.core.workflow.DefaultDataProduct.java

@Override
public void configure(final String conf) throws EoulsanException {

    checkState(dataproduct == null, "configure() has been already called");

    final String s = Strings.nullToEmpty(conf).trim().toLowerCase();

    switch (s) {/*www  . j a  v  a 2s.  c  o m*/

    case MatchDataProduct.DATAPRODUCT_NAME:
        this.dataproduct = new MatchDataProduct();
        break;

    case CrossDataProduct.DATAPRODUCT_NAME:
    case "":
        this.dataproduct = new CrossDataProduct();
        break;

    default:
        throw new EoulsanException("Unknown data product method: " + conf);
    }

    this.dataproduct.configure(conf);
}

From source file:fr.da2i.lup1.entity.formation.Member.java

public String getFirstName() {
    return Strings.nullToEmpty(firstName);
}

From source file:com.eincs.decanter.handler.codec.http.DecanterHttpRequest.java

public String getPath() {
    return Strings.nullToEmpty(path);
}

From source file:ec.tss.tsproviders.sdmx.engine.CunningPlanFactory.java

public AbstractDocumentFactory find(Document doc) throws IOException {
    for (AbstractDocumentFactory o : strategies) {
        if (o.isValid(doc)) {
            return o;
        }//from w  w w .  j  ava  2  s.  c  om
    }
    throw new IOException(
            "Cannot find a suitable SDMX strategy for '" + Strings.nullToEmpty(doc.getDocumentURI()) + "'");
}

From source file:org.opendaylight.aaa.impl.shiro.tokenauthrealm.auth.ClaimBuilder.java

public ClaimBuilder setDomain(String domain) {
    this.domain = Strings.nullToEmpty(domain).trim();
    return this;
}

From source file:com.android.tools.idea.jps.output.parser.aapt.Error6Parser.java

@Override
public boolean parse(@NotNull String line, @NotNull OutputLineReader reader,
        @NotNull Collection<CompilerMessage> messages) throws ParsingFailedException {
    Matcher m = MSG_PATTERN.matcher(line);
    if (!m.matches()) {
        return false;
    }//from   w  w  w  .ja v a2  s . c  om
    String sourcePath = m.group(1);
    String msgText = line; // default message is the line in case we don't find anything else
    if (reader.hasNextLine()) {
        msgText = Strings.nullToEmpty(reader.readLine()).trim();
        if (reader.hasNextLine()) {
            msgText = msgText + " - " + Strings.nullToEmpty(reader.readLine()).trim();
            // skip the next line
            reader.skipNextLine();
        }
    }
    CompilerMessage msg = createErrorMessage(msgText, sourcePath, null);
    messages.add(msg);
    return true;
}

From source file:com.android.ide.common.blame.parser.aapt.Error6Parser.java

@Override
public boolean parse(@NonNull String line, @NonNull OutputLineReader reader, @NonNull List<Message> messages,
        @NonNull ILogger logger) throws ParsingFailedException {
    Matcher m = MSG_PATTERN.matcher(line);
    if (!m.matches()) {
        return false;
    }//from   w  w w  .j  a v  a 2 s  .c  om
    String sourcePath = m.group(1);
    String msgText = line; // default message is the line in case we don't find anything else
    if (reader.hasNextLine()) {
        msgText = Strings.nullToEmpty(reader.readLine()).trim();
        if (reader.hasNextLine()) {
            msgText = msgText + " - " + Strings.nullToEmpty(reader.readLine()).trim();
            // skip the next line
            reader.skipNextLine();
        }
    }
    Message msg = createMessage(Message.Kind.ERROR, msgText, sourcePath, null, "", logger);
    messages.add(msg);
    return true;
}

From source file:com.github.cassandra.jdbc.CassandraColumnDefinition.java

public CassandraColumnDefinition(String schema, String table, String name, String label, String type,
        boolean searchable, boolean writable) {
    this.catalog = EMPTY_STRING;
    this.schema = Strings.nullToEmpty(schema);
    this.table = Strings.nullToEmpty(table);
    this.name = Strings.nullToEmpty(name);
    this.label = Strings.isNullOrEmpty(label) ? name : label;
    this.cqlType = CassandraDataTypeMappings.instance.cqlTypeFor(type);
    this.sqlType = CassandraDataTypeMappings.instance.sqlTypeFor(this.cqlType);
    this.javaType = CassandraDataTypeMappings.instance.javaTypeFor(this.cqlType);
    this.searchable = searchable;
    this.writable = writable;
    this.precision = CassandraDataTypeMappings.instance.precisionFor(this.cqlType);
    this.scale = CassandraDataTypeMappings.instance.scaleFor(this.cqlType);
}

From source file:de.schildbach.pte.MerseyProvider.java

@Override
protected Line parseLine(final @Nullable String id, final @Nullable String network, final @Nullable String mot,
        final @Nullable String symbol, final @Nullable String name, final @Nullable String longName,
        final @Nullable String trainType, final @Nullable String trainNum, final @Nullable String trainName) {
    if ("13".equals(mot)) {
        if ("OO".equals(trainType) || "Ordinary passenger (o.pas.)".equals(trainName))
            return new Line(id, network, Product.REGIONAL_TRAIN, "OO" + Strings.nullToEmpty(trainNum));
    }/*from   w  w w.ja v  a2 s.  com*/

    return super.parseLine(id, network, mot, symbol, name, longName, trainType, trainNum, trainName);
}

From source file:io.macgyver.core.web.mvc.SearchController.java

public void search(String q, MenuItem current, List<MenuItem> results) {
    current.getItems().iterator().forEachRemaining(it -> {

        search(q, it, results);// www . j  a v a2  s. c om

    });

    String label = Strings.nullToEmpty(current.getLabel()).toLowerCase();

    if (label.contains(q)) {
        results.add(current);

    }
}