Example usage for org.apache.commons.lang3 StringUtils trimToNull

List of usage examples for org.apache.commons.lang3 StringUtils trimToNull

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils trimToNull.

Prototype

public static String trimToNull(final String str) 

Source Link

Document

Removes control characters (char <= 32) from both ends of this String returning null if the String is empty ("") after the trim or if it is null .

Usage

From source file:org.openestate.io.idx.types.Language.java

public static Language parse(String value) {
    value = StringUtils.trimToNull(value);
    if (value == null)
        return null;

    for (Language l : Language.values()) {
        if (String.valueOf(l.value).equalsIgnoreCase(value))
            return l;
    }/* ww w .  ja va  2s .  c  o  m*/
    return null;
}

From source file:org.openestate.io.idx.types.Media.java

public void setDescription(String value) {
    this.description = StringUtils.trimToNull(value);
}

From source file:org.openestate.io.idx.types.Media.java

public void setFileName(String value) {
    this.fileName = StringUtils.trimToNull(value);
}

From source file:org.openestate.io.idx.types.Media.java

public void setTitle(String value) {
    this.title = StringUtils.trimToNull(value);
}

From source file:org.openestate.io.idx.types.Media.java

public void setUrl(String value) {
    this.url = StringUtils.trimToNull(value);
}

From source file:org.openestate.io.idx.types.ObjectCategory.java

public static ObjectCategory parse(String value) {
    value = StringUtils.trimToNull(value);
    if (value == null)
        return null;
    try {//from  w w w . j a v  a2s .c om
        return ObjectCategory.valueOf(value);
    } catch (Exception ex) {
        return null;
    }
}

From source file:org.openestate.io.idx.types.ObjectType.java

public static ObjectType parse(ObjectCategory category, String value) {
    if (category == null)
        return null;
    value = StringUtils.trimToNull(value);
    if (value == null)
        return null;
    try {//from  w ww . ja  v  a2 s.  c om
        int num = Integer.parseInt(value);
        for (ObjectType t : ObjectType.values()) {
            if (category.equals(t.category) && num == t.value)
                return t;
        }
        return null;
    } catch (Exception ex) {
        return null;
    }
}

From source file:org.openestate.io.idx.types.OfferType.java

public static OfferType parse(String value) {
    value = StringUtils.trimToNull(value);
    if (value == null)
        return null;
    try {/*from  w ww.  j  a  v a  2s . c o  m*/
        return OfferType.valueOf(value);
    } catch (Exception ex) {
        return null;
    }
}

From source file:org.openestate.io.idx.types.PriceUnit.java

public static PriceUnit parse(String value) {
    value = StringUtils.trimToNull(value);
    if (value == null)
        return null;
    try {//from www .j a  v  a 2s. co m
        return PriceUnit.valueOf(value);
    } catch (Exception ex) {
        return null;
    }
}

From source file:org.openestate.io.idx.types.Salutation.java

public static Salutation parse(String value) {
    value = StringUtils.trimToNull(value);
    if (value == null)
        return null;

    for (Salutation s : Salutation.values()) {
        if (String.valueOf(s.value).equalsIgnoreCase(value))
            return s;
    }/*from  ww w.  j  a  va2  s  .c  om*/
    return null;
}