Class TypeUtility
java.lang.Object
org.gcube.informationsystem.utils.TypeUtility
A utility class for retrieving the type name from various sources.
- Author:
- Luca Frosini (ISTI - CNR)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetTypeName(Class<E> clz) Gets the type name from a class that extendsElement.static StringgetTypeName(String json) Gets the type name from a JSON string.static StringgetTypeName(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode) Gets the type name from aJsonNode.
-
Constructor Details
-
TypeUtility
public TypeUtility()
-
-
Method Details
-
getTypeName
Gets the type name from aJsonNode.- Parameters:
jsonNode- The JSON node.- Returns:
- The type name, or
nullif not found.
-
getTypeName
public static String getTypeName(String json) throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException, IOException Gets the type name from a JSON string.- Parameters:
json- The JSON string.- Returns:
- The type name.
- Throws:
IOException- if an I/O error occurs.org.gcube.com.fasterxml.jackson.core.JsonProcessingException- if a JSON processing error occurs.
-
getTypeName
Gets the type name from a class that extendsElement.- Type Parameters:
E- the element type- Parameters:
clz- The class.- Returns:
- The type name.
-