Class ExtensibilityConverter


  • public class ExtensibilityConverter
    extends Object
    Converts between Java types and JSON according to the extensibility naming rules.
    • 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)
      • 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.
      • getFoundClasses

        protected com.google.common.cache.Cache<String,​Class> getFoundClasses()