This is not a duplicate, please read the question and understand that I have an Object (not a char[], not an Object[], but an Object)
public String getStringFromObject(Object o){
// What do I do here to get a String? o is actually a char[]
}
I have a java Object that represents a character array:
I get passed an Object cred
into a method
L.info("Credentials component type is {} and is array -> {}",
cred.getClass().getComponentType(), cred.getClass().isArray());
This prints: Token's credentials are: [s, d, f] and type is [C
How do I get this into a String? I can't figure out how to cast the Object to any kind of []
array. If it was Object[]
to start with it would not be a problem.