Class Util


  • public class Util
    extends java.lang.Object
    Shared code refactored from other spots to reduce duplication and improve maintainability
    • Constructor Detail

      • Util

        public Util()
    • Method Detail

      • getStartingView

        public static CASImpl getStartingView​(CAS cas,
                                              boolean sofaAware,
                                              ComponentInfo componentInfo)
      • setupViewSwitchClassLoaders

        public static <T extends AbstractCas> T setupViewSwitchClassLoaders​(CAS cas,
                                                                            boolean sofaAware,
                                                                            ComponentInfo componentInfo,
                                                                            ResourceManager resourceManager,
                                                                            java.lang.Class<T> casInterface)
      • preserveContextHolder

        public static void preserveContextHolder​(java.lang.Runnable userCode)
        Calls userCode and then restores the context holder
        Parameters:
        userCode - run this code within the current context
      • withContextHolder

        public static void withContextHolder​(UimaContext context,
                                             java.lang.Runnable userCode)
        Calls userCode with specified context, then restores the context holder
        Parameters:
        context - to use while running the userCode
        userCode - the code to run.
      • withContextHolderX

        public static void withContextHolderX​(UimaContext context,
                                              Runnable_withException userCode)
                                       throws java.lang.Exception
        Calls userCode with specified context, then restores the context holder
        Parameters:
        context - to use while running the userCode
        userCode - the code to run.
        Throws:
        java.lang.Exception - -