Im using the following code to convert type object to string,
fieldValue
defined as is type object .
keyl.put(fieldName, (String) fieldValue);
the values of the type object can be only java types such as
java decimal ,byte,float, calendar ,date etc ...
when i got in fieldValue
value of java.util.date
I got an exception since the casting is not success.
how can i overcome this issue?
fieldValue
is Object type then maybe instead of casting usefieldValue.toString()
, or if it can be primitive type thenString.valueOf(fieldValue)
. – Pshemo Jun 19 '13 at 15:36fieldValue
is possiblynull
thenString.valueOf(fieldValue)
will preventNullPointerException
– selig Jun 19 '13 at 15:38