I have a method:
public void extractStringFromField(Class> classToInspect) {
Field[] allFields = classToInspect.getDeclaredFields();
for(Fie
Just had the same issue. This Thread somewhat helped. Just for reference if somebody else stumbles upon this thread. I used the StringBuilder class to convert so basically:
StringBuilder builder = new StringBuilder();
builder.append(field.get(object))
Which has multiple advantages. One that you do not explicitly cast (which btw. causes problems with primitive types int vs. Integer) but also of being more efficient if you have multiple string operations sequentialy. In time critical code parts.