Package com.cumulocity.model.util
Class ExtensibilityConverter
- java.lang.Object
-
- com.cumulocity.model.util.ExtensibilityConverter
-
public class ExtensibilityConverter extends Object
Converts between Java types and JSON according to the extensibility naming rules.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ExtensibilityConverter(Duration cacheTimeout, ClassFinder classFinder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Class
classFromExtensibilityString(String name)
Converts the given name into a class using the extensibility rules where underscores ("_") are converted to dots (".").protected Class
classFromExtensibilityString2(String name)
static <T> String
classToStringRepresentation(Class<T> clazz)
Returns a string representation of the canonical name of the given class but with dots (".") replaced with underscores ("_").protected com.google.common.cache.Cache<String,Class>
getFoundClasses()
static boolean
isConvertable(String name)
-
-
-
Constructor Detail
-
ExtensibilityConverter
protected ExtensibilityConverter(Duration cacheTimeout, ClassFinder classFinder)
-
-
Method Detail
-
classFromExtensibilityString
public static Class classFromExtensibilityString(String name) throws ClassNotFoundException
Converts the given name into a class using the extensibility rules where underscores ("_") are converted to dots ("."). For example:
name = "com_cumulocity_model_idtype_Reference" would return the class com.cumulocity.mode.idtype.Reference- Throws:
ClassNotFoundException
- if the name cannot be converted to a class using the extensibility rules
-
isConvertable
public static boolean isConvertable(String name)
-
classFromExtensibilityString2
protected Class classFromExtensibilityString2(String name) throws ClassNotFoundException
- Throws:
ClassNotFoundException
-
classToStringRepresentation
public static <T> String classToStringRepresentation(Class<T> clazz)
Returns a string representation of the canonical name of the given class but with dots (".") replaced with underscores ("_"). Useful for creating JSON property names from class names.
-
-