Here you can find the source of objectToString(final Object value)
Parameter | Description |
---|---|
value | An object |
public static String objectToString(final Object value)
//package com.java2s; // Licensed under the MIT license. See License.txt in the repository root. public class Main { /**/* w w w . ja va 2 s . c o m*/ * For Visual Studio compatibility. Takes an Object and returns a string * representation. Generally calls Object.toString(), unless we know that * TFS wants a particular type formatted a particular way. * * @param value * An object * @return The string representation of an object */ public static String objectToString(final Object value) { if (value instanceof Double) { return doubleToString((Double) value); } else { return value.toString(); } } /** * For Visual Studio compatibility: converts a Double-type to a String, but * ensures that whole numbers have no decimal point. * * This is for rule engine parsing and display. Ie, when we have a double * value "0", we display it as "0.0", while .NET (and C# in general) * displays "0". This leads to interop headaches, particularly with * ALLOWEDVALUES fields. * * @param value * A Double to convert to a String * @return A String representation of a Double */ public static String doubleToString(final Double value) { if (value == null) { return null; } if (value.intValue() == value.doubleValue()) { return Integer.toString(value.intValue()); } return value.toString(); } }