Im using the following code that fieldValue can have a simple property, there is a way to check before im doing this code if fieldValue does not contain an object that cannot be passed to a string? To avoid a dump
keyVal.put(fieldName, (String) fieldValue);
if (fieldValue instanceof String)
Since String is a final class (and therefore cannot have subclasses), I would consider using getClass over instanceof :
String
final
getClass
instanceof
if (fieldValue != null && fieldValue.getClass() == String.class)
if (fieldValue instanceof String) { keyVal.put(fieldName, (String) fieldValue); }
Source: https://habr.com/ru/post/1485479/More articles:Overriding Variables Sass - variablesHow many data types does option support increase? - c ++In emacs, can I get a comment pane to use a block comment instead of commenting out each line? - xmlA way to handle multiple "Is" statements - c #Paste high performance data in SQL Server - c #Load Balance: Node.js - Socket.io - Redis - node.jsRotating SVG with Css (animation) - htmlMultiple concurrent MSys / MingW installations on Windows - windowsDeclare a large array on the stack - c ++Android breaks my text when using fragments - androidAll Articles