Example usage for org.apache.commons.lang ObjectUtils toString

List of usage examples for org.apache.commons.lang ObjectUtils toString

Introduction

In this page you can find the example usage for org.apache.commons.lang ObjectUtils toString.

Prototype

public static String toString(Object obj) 

Source Link

Document

Gets the toString of an Object returning an empty string ("") if null input.

 ObjectUtils.toString(null)         = "" ObjectUtils.toString("")           = "" ObjectUtils.toString("bat")        = "bat" ObjectUtils.toString(Boolean.TRUE) = "true" 

Usage

From source file:com.opengamma.elsql.LikeSqlFragment.java

@Override
protected void toSQL(StringBuilder buf, ElSqlBundle bundle, SqlParameterSource paramSource) {
    String value = ObjectUtils.toString(paramSource.getValue(_variable));
    if (bundle.getConfig().isLikeWildcard(value)) {
        buf.append("LIKE ");
        super.toSQL(buf, bundle, paramSource);
        buf.append(bundle.getConfig().getLikeSuffix());
    } else {/* w ww. j  a  va2s .c om*/
        buf.append("= ");
        super.toSQL(buf, bundle, paramSource);
    }
}

From source file:com.mysoft.b2b.solr.db.ScoreReader.java

/**
 * ?id//from  www.jav a 2  s. c om
 */
public static Integer getSupplierScoreById(String supplierId) {
    if (scoreList == null) {
        return 0;
    }
    return NumberUtils.toInt(ObjectUtils.toString(scoreList.get(supplierId)));

}

From source file:br.com.autonomiccs.autonomic.plugin.common.utils.NotifySmartAcsStartUpUtils.java

public void sendModuleStartUp(Class<?> clazz) {
    try {/*from w w  w  .jav  a2s. c  om*/
        URI uri = new URI("http", "smartcloudstack.lrg.ufsc.br:8080", "/boot/log/" + uuid,
                String.format("msg=Module initialized[%s]", ObjectUtils.toString(clazz)), null);
        httpUtils.executeHttpGetRequest(uri.toURL());
    } catch (IOException | URISyntaxException e) {
        logger.info("Problems while notifying home about the modules startup.");
    }
}

From source file:com.pyxis.jira.monitoring.MonitorCustomField.java

public String getStringFromSingularObject(Object o) {
    return ObjectUtils.toString(o);
}

From source file:com.eyeq.pivot4j.ui.property.SimpleProperty.java

/**
 * @see com.eyeq.pivot4j.ui.property.Property#getValue(com.eyeq.pivot4j.ui.RenderContext)
 *///w ww  . ja va 2s . com
@Override
public String getValue(RenderContext context) {
    if (context == null) {
        throw new NullArgumentException("context");
    }

    if (value == null) {
        return null;
    }

    ExpressionEvaluator evaluator = context.getExpressionEvaluator();

    return ObjectUtils.toString(evaluator.evaluate(value, context.getExpressionContext()));
}

From source file:com.syaku.commons.PageNavigator.java

/**
* @method : setPageIndex/*  w ww.j  av  a2s .  c  om*/
* @brief   
*/

public void setPageIndex(int total_count) {
    this.total_count = total_count;
    total_page = ((this.total_count - 1) / page_row) + 1;
    start_page = ((page - 1) / page_link) * page_link + 1;
    now_page = (start_page / page_link) + 1;
    end_page = start_page + (page_link - 1);
    start_idx = (page - 1) * page_row;
    virtual_idx = total_count - (page_row * (page - 1));

    log.info(StringUtils.join(new String[] { "{PageNavigator.setPageIndex}\r\n",
            "==========================================================================\r\n",
            "> total_count : ", ObjectUtils.toString(this.total_count), "\r\n", "> page_row : ",
            ObjectUtils.toString(page_row), "\r\n", "> page_link : ", ObjectUtils.toString(page_link), "\r\n",
            "> page : ", ObjectUtils.toString(page), "\r\n", "> total_page : ",
            ObjectUtils.toString(total_page), "\r\n", "> start_page : ", ObjectUtils.toString(start_page),
            "\r\n", "> now_page : ", ObjectUtils.toString(now_page), "\r\n", "> end_page : ",
            ObjectUtils.toString(end_page), "\r\n", "> start_idx : ", ObjectUtils.toString(start_idx), "\r\n",
            "> virtual_idx : ", ObjectUtils.toString(virtual_idx), "\r\n",
            "==========================================================================" }));
}

From source file:jp.co.opentone.bsol.linkbinder.util.elasticsearch.CorresponDocumentConverter.java

/**
 * ??.// w ww.  j  a va2s .c o  m
 * @param correspon 
 * @param attachments 
 * @return ??
 */
public static List<ElasticsearchDocument> convert(Correspon correspon, List<Attachment> attachments) {
    List<ElasticsearchDocument> result = Lists.newArrayList();
    CorresponElasticsearchDocument doc = new CorresponElasticsearchDocument();
    doc.id = String.valueOf(correspon.getId());
    doc.type = SystemConfig.getValue(Constants.KEY_ELASTICSEARCH_TYPE_NAME);
    doc.title = correspon.getSubject();
    doc.body = Jsoup.parse(correspon.getBody()).text();
    doc.lastModified = DateUtil.convertDateToString(correspon.getUpdatedAt());
    doc.workflowStatus = String.valueOf(correspon.getWorkflowStatus().getValue());
    doc.forLearning = String.valueOf(correspon.getForLearning().getValue());

    result.add(doc);

    attachments.forEach(a -> {
        CorresponElasticsearchDocument attachmentDoc = new CorresponElasticsearchDocument();
        attachmentDoc.id = ObjectUtils.toString(a.getId()) + "@" + correspon.getId();
        attachmentDoc.type = doc.type;
        attachmentDoc.title = StringUtils.EMPTY;
        attachmentDoc.body = StringUtils.EMPTY;
        attachmentDoc.lastModified = doc.lastModified;
        attachmentDoc.workflowStatus = doc.workflowStatus;
        attachmentDoc.workflowStatus = doc.forLearning;

        attachmentDoc.attachments = Lists
                .newArrayList(new CorresponElasticsearchDocument.Attachment(ObjectUtils.toString(a.getId()),
                        a.getFileName(), ConvertUtil.toBase64String(a.getContent()), a.getExtractedText()));

        result.add(attachmentDoc);
    });

    return result;
}

From source file:com.googlecode.markuputils.MarkupUtils.java

public static String appendAttribute(String name, Object value) {

    StringBuilder buffer = new StringBuilder();

    String valueString = ObjectUtils.toString(value).trim();

    if (StringUtils.isNotBlank(valueString)) {
        buffer.append(" ").append(name).append("=\"").append(valueString).append("\"");
    }//from w w  w  .j  av  a 2 s .c om

    return buffer.toString();

}

From source file:de.schildbach.game.common.ChessLikeMove.java

@Override
public String toString() {
    StringBuilder builder = new StringBuilder();
    builder.append(ObjectUtils.toString(source));
    builder.append("-");
    builder.append(ObjectUtils.toString(target));
    return builder.toString();
}

From source file:mitm.djigzo.web.common.GenericValueEncoder.java

@Override
public String toClient(T obj) {
    return idFieldAdapter == null ? ObjectUtils.toString(obj) : ObjectUtils.toString(idFieldAdapter.get(obj));
}