Class ClsLoader


  • public class ClsLoader
    extends java.lang.Object
    Helper for loading class instances

    This is primarily used as a helper by MappedLoader to dynamically load in functions without a need to pre-register them. Since these class names originate from URIs which may contain characters which are not valid in Java class names this class implements a simple escaping scheme.

    Escaping Scheme

    Escaping is applied only to the last portion of the class name, typically MappedLoader takes care of mapping a function library namespace prefix into a java package name and likely only the last portion (the function name) will require escaping.

    If the first character of the class name is invalid it is replaced with F_. If any subsequent characters are invalid they are ignored and the subsequent valid character (if any) is promoted to upper case giving a camel case style valid class name.

    For example if the last portion of the class name were foo-bar-faz then we would end up with an escaped class name of fooBarFaz.

    • Constructor Summary

      Constructors 
      Constructor Description
      ClsLoader()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String escape​(java.lang.String className)  
      static java.lang.Object loadAndInstantiate​(java.lang.String uri, java.lang.Class<?> requiredClass)  
      static java.lang.Class<?> loadClass​(java.lang.String classNameOrURI)  
      static java.lang.Class<?> loadClass​(java.lang.String classNameOrURI, java.lang.Class<?> requiredClass)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ClsLoader

        public ClsLoader()
    • Method Detail

      • loadClass

        public static java.lang.Class<?> loadClass​(java.lang.String classNameOrURI)
      • loadClass

        public static java.lang.Class<?> loadClass​(java.lang.String classNameOrURI,
                                                   java.lang.Class<?> requiredClass)
      • loadAndInstantiate

        public static java.lang.Object loadAndInstantiate​(java.lang.String uri,
                                                          java.lang.Class<?> requiredClass)
      • escape

        public static java.lang.String escape​(java.lang.String className)