Example usage for java.lang Object toString

List of usage examples for java.lang Object toString

Introduction

In this page you can find the example usage for java.lang Object toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:Main.java

public static void sop(Object obj) {

    System.out.println(obj.toString());
}

From source file:Main.java

/**
 * clean the src of ' and <>/*w ww . j  ava2 s  .  c  o  m*/
 */
public static String clean(Object src) {
    String result = src.toString().replaceAll("'", "\'").replaceAll("[><\n\r]", " ");
    return result;
}

From source file:Main.java

/**
 * Check if object is expression base on altSyntax
 *
 * @param value to treat as an expression
 * @return true if it is an expression//from   w ww.  ja v a 2s.c  o  m
 */
public static boolean isExpression(Object value) {
    String expr = value.toString();
    return expr.startsWith("%{") && expr.endsWith("}");
}

From source file:Main.java

public static String toString(Object obj) {
    return obj == null ? "" : obj.toString();
}

From source file:Main.java

public static String doString(Object obj) {
    return obj != null ? obj.toString() : "";
}

From source file:Main.java

public static String listToString(List list) {
    StringBuffer sb = new StringBuffer();
    for (Object o : list) {
        sb.append(o.toString() + " ");
    }//from   www  .ja v  a2s .c  om
    return sb.toString();
}

From source file:Main.java

public static String filterNull(Object value) {
    return value == null ? "" : value.toString();
}

From source file:Main.java

public static String getStrVal(Object o) {
    String result = (o != null) ? o.toString() : "";
    return result;
}

From source file:Main.java

public static boolean isTrue(Object value) {
    if (value != null && value.toString().toLowerCase().equals("true")) {
        return true;
    } else {/*from w  w  w .  j  av  a 2 s . c o  m*/
        return false;
    }
}

From source file:Main.java

public static <T> boolean isElementExsit(List<Object> es, T e) {
    if (es == null || es.size() == 0)
        return false;
    for (Object a : es) {
        if (a.toString().equals(e)) {
            return true;
        }//from   w ww.  ja  va  2  s.com
    }
    return false;

}