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:io.druid.query.extraction.IdentityExtractionFn.java

@Override
public String apply(String value) {
    return Strings.emptyToNull(value);
}

From source file:org.n52.shetland.ogc.sos.ObjectWithXmlString.java

public ObjectWithXmlString(T object, String xml) {
    this.object = Optional.ofNullable(object);
    this.xml = Optional.ofNullable(Strings.emptyToNull(xml));
    if (!Optionals.any(this.object, this.xml)) {
        throw new NullPointerException();
    }/*ww w. j a  va 2 s. c  o  m*/
}

From source file:com.github.autermann.wps.commons.description.ows.OwsCRS.java

public OwsCRS(String value) {
    this.value = checkNotNull(Strings.emptyToNull(value));
}

From source file:com.github.autermann.wps.commons.description.ows.OwsLanguageString.java

public OwsLanguageString(String lang, String value) {
    this.lang = Strings.emptyToNull(lang);
    this.value = checkNotNull(Strings.emptyToNull(value));
}

From source file:org.haiku.pkg.model.PkgUrl.java

public PkgUrl(String input, PkgUrlType urlType) {
    super();//from w  w  w . j a v  a2s. com
    Preconditions.checkNotNull(urlType);
    Preconditions.checkState(!Strings.isNullOrEmpty(input));

    input = input.trim();

    if (Strings.isNullOrEmpty(input)) {
        throw new IllegalStateException(
                "the input must be supplied and should not be an empty string when trimmed.");
    }

    Matcher matcher = PATTERN_NAMEANDURL.matcher(input);

    if (matcher.matches()) {
        this.url = matcher.group(3);
        this.name = Strings.emptyToNull(matcher.group(1).trim());
    } else {
        this.url = input;
    }

    this.urlType = urlType;
}

From source file:org.gradle.internal.component.local.model.DefaultLibraryComponentSelector.java

public DefaultLibraryComponentSelector(String projectPath, String libraryName) {
    assert !Strings.isNullOrEmpty(projectPath) : "project path cannot be null or empty";
    this.projectPath = projectPath;
    this.libraryName = Strings.emptyToNull(libraryName);
}

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

public OwsResponsibleParty(String individualName, String organisationName, String positionName,
        OwsContact contactInfo, OwsCode role) {
    this.individualName = Optional.ofNullable(Strings.emptyToNull(individualName));
    this.organisationName = Optional.ofNullable(Strings.emptyToNull(organisationName));
    this.positionName = Optional.ofNullable(Strings.emptyToNull(positionName));
    this.contactInfo = Optional.ofNullable(contactInfo);
    this.role = Optional.ofNullable(role);
}

From source file:org.impressivecode.depress.support.activitymatcher.Configuration.java

public Configuration(final SettingsModelInteger interval, final SettingsModelString builder,
        final List<ITSDataType> issues) {

    this.builderFormat = Strings.emptyToNull(builder.getStringValue());
    this.issues = issues;
    this.interval = interval.getIntValue();
}

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

private static ActionLayout.CssClassFaPosition cssClassFaPosition(final Properties properties) {
    if (properties == null) {
        return null;
    }//from   ww  w  . ja va 2 s  .com
    String cssClassFaPosition = Strings.emptyToNull(properties.getProperty("cssClassFaPosition"));
    return cssClassFaPosition != null
            ? ActionLayout.CssClassFaPosition.valueOf(cssClassFaPosition.toUpperCase())
            : ActionLayout.CssClassFaPosition.LEFT;
}

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

public OwsCode(String value, URI codeSpace) {
    this.value = Objects.requireNonNull(Strings.emptyToNull(value));
    this.codeSpace = Optional.ofNullable(codeSpace);
}