Added convenient method to get type name from an instance

This commit is contained in:
Luca Frosini 2021-01-28 23:15:46 +01:00
parent a8e1b0da6e
commit 4ccc840377
1 changed files with 4 additions and 0 deletions

View File

@ -91,6 +91,10 @@ public class TypeMapper {
return serializeTypeDefinition(type); return serializeTypeDefinition(type);
} }
public static <E extends Element> String getType(E e){
return getType(e.getClass());
}
public static String getType(Class<? extends Element> clz){ public static String getType(Class<? extends Element> clz){
String classSimpleName = clz.getSimpleName(); String classSimpleName = clz.getSimpleName();
String name = null; String name = null;