Class ModuleLocation

  • All Implemented Interfaces:
    java.util.function.Function<java.lang.Class<?>,​java.net.URI>

    class ModuleLocation
    extends java.lang.Object
    implements java.util.function.Function<java.lang.Class<?>,​java.net.URI>
    Equivalent of ...
     Module module = clazz.getModule();
     if (module != null)
     {
         Configuration configuration = module.getLayer().configuration();
         Optional resolvedModule = configuration.findModule(module.getName());
         if (resolvedModule.isPresent())
         {
             ModuleReference moduleReference = resolvedModule.get().reference();
             Optional location = moduleReference.location();
             if (location.isPresent())
             {
                 return location.get();
             }
         }
     }
     return null;
     
    In Jetty 10, this entire class can be moved to direct calls to java.lang.Module in TypeUtil.getModuleLocation()
    • Constructor Summary

      Constructors 
      Constructor Description
      ModuleLocation()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.net.URI apply​(java.lang.Class<?> clazz)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.function.Function

        andThen, compose
    • Field Detail

      • LOG

        private static final Logger LOG
      • classModule

        private final java.lang.Class<?> classModule
      • handleGetModule

        private final java.lang.invoke.MethodHandle handleGetModule
      • handleGetLayer

        private final java.lang.invoke.MethodHandle handleGetLayer
      • handleConfiguration

        private final java.lang.invoke.MethodHandle handleConfiguration
      • handleGetName

        private final java.lang.invoke.MethodHandle handleGetName
      • handleOptionalResolvedModule

        private final java.lang.invoke.MethodHandle handleOptionalResolvedModule
      • handleReference

        private final java.lang.invoke.MethodHandle handleReference
      • handleLocation

        private final java.lang.invoke.MethodHandle handleLocation
    • Constructor Detail

      • ModuleLocation

        public ModuleLocation()
    • Method Detail

      • apply

        public java.net.URI apply​(java.lang.Class<?> clazz)
        Specified by:
        apply in interface java.util.function.Function<java.lang.Class<?>,​java.net.URI>