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 adToXML(Object[] args, String rootName, String elemName, StringBuffer xmlStr) {
    xmlStr.append("<" + rootName + ">");

    for (Object arg : args) {
        if (arg == null)
            arg = "";
        xmlStr.append("<" + elemName + ">" + arg.toString() + "</" + elemName + ">");
    }//from  w ww .j  ava  2 s.c  om

    xmlStr.append("</" + rootName + ">");

}

From source file:edu.stanford.muse.index.Trace.java

public static void trace(Object message, Object o) {
    if (traceTerms.size() == 0)
        return;//from ww  w  .j a  v  a  2s  .  c  o  m
    String s = o.toString();
    for (String traceTerm : traceTerms)
        if (s.toString().toLowerCase().indexOf(traceTerm) >= 0)
            log.info(message + ": " + s);
}

From source file:edu.stanford.muse.index.Trace.java

public static void trace(Object message1, Object message2, Object o) {
    if (traceTerms.size() == 0)
        return;//from  w  w w  .  j a  v  a 2s  .  c o  m
    String s = o.toString();
    for (String traceTerm : traceTerms)
        if (s.toString().toLowerCase().indexOf(traceTerm) >= 0)
            log.info(message1 + ": " + message2 + ": " + s);
}

From source file:edu.stanford.muse.index.Trace.java

public static void trace(Object message1, Object message2, Object message3, Object o) {
    if (traceTerms.size() == 0)
        return;/*w w w . j a v  a2s. co m*/
    String s = o.toString();
    for (String traceTerm : traceTerms)
        if (s.toString().toLowerCase().indexOf(traceTerm) >= 0)
            log.info(message1 + ": " + message2 + ": " + message3 + ": " + s);
}

From source file:imageClassify.Describe.java

private static List<String> convert(Collection<?> values) {
    List<String> list = Lists.newArrayListWithCapacity(values.size());
    for (Object value : values) {
        list.add(value.toString());
    }/*from  w w  w  .ja va  2  s . com*/
    return list;
}

From source file:net.datenwerke.transloader.primitive.WrapperConverter.java

private static boolean booleanValue(Object wrapper) {
    return Boolean.valueOf(wrapper.toString()).booleanValue();
}

From source file:Main.java

public static void intentToAndroidLayoutMapper(Class<?> classObj, Intent intent, String prefixStr,
        Activity view) {/*w  ww  . j a v  a2s  . c  o m*/

    Bundle map = intent.getExtras();

    for (Object keyObj : map.keySet().toArray()) {
        String keyStr = keyObj.toString();
        Field fieldObj = null;
        try {
            fieldObj = classObj.getField(prefixStr + "_" + keyStr);
        } catch (NoSuchFieldException e) {
            continue;
        }
        Object layoutObj = null;
        try {
            layoutObj = fieldObj.get(fieldObj);
        } catch (IllegalAccessException e) {
            continue;
        }
        Integer layoutIntvalue = (Integer) layoutObj;

        View selectedView = view.findViewById(layoutIntvalue);

        if (selectedView instanceof TextView) {
            TextView textView = (TextView) selectedView;
            textView.setText((String) map.get(keyStr));
        } else if (selectedView instanceof ImageView) {
            ImageView imageView = (ImageView) selectedView;

        }

    }

}

From source file:Main.java

public static Double prod(Object o1, Object o2) {
    if (o1 == null || o2 == null)
        return Double.valueOf("0");
    return Double.valueOf(o1.toString()) * Double.valueOf(o2.toString());
}

From source file:Main.java

public static String[] toStringArray(final Object[] array) {
    if (array == null)
        return null;
    final int length = array.length;
    final String[] string_array = new String[length];
    for (int i = 0; i < length; i++) {
        final Object item = array[i];
        string_array[i] = item != null ? item.toString() : null;
    }//from  w w  w .jav a  2 s. c  om
    return string_array;
}

From source file:Main.java

/**
 * Convenient method to print an iterable.
 * @param iterable iterable to print/*  ww  w .j  a  v  a  2  s. c o  m*/
 * @param out print stream
 */
public static void println(Iterable iterable, PrintStream out) {
    for (Object o : iterable) {
        if (o == null) {
            continue;
        }
        out.println(o.toString());
    }
}