Package org.apache.uima.impl

# Class Util

java.lang.Object
org.apache.uima.impl.Util

public class Util extends Object
Shared code refactored from other spots to reduce duplication and improve maintainability

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Util()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static CASImpl`
  `getStartingView(CAS cas, boolean sofaAware, ComponentInfo componentInfo)`
  `static void`
  `preserveContextHolder(Runnable userCode)`
  Calls userCode and then restores the context holder
  `static <T extends AbstractCas>
  T`
  `setupViewSwitchClassLoaders(CAS cas, boolean sofaAware, ComponentInfo componentInfo, ResourceManager resourceManager, Class<T> casInterface)`
  `static AbstractCas`
  `setupViewSwitchClassLoadersLockCas(CAS cas, boolean sofaAware, ComponentInfo componentInfo, ResourceManager resourceManager, Class<? extends AbstractCas> casInterface)`
  `static void`
  `withContextHolder(UimaContext context, Runnable userCode)`
  Calls userCode with specified context, then restores the context holder
  `static void`
  `withContextHolderX(UimaContext context, org.apache.uima.internal.util.function.Runnable_withException userCode)`
  Calls userCode with specified context, then restores the context holder

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Util

    public Util()

- ## Method Details

  - ### getStartingView

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

  - ### setupViewSwitchClassLoadersLockCas

    public static AbstractCas setupViewSwitchClassLoadersLockCas(CAS cas, boolean sofaAware, ComponentInfo componentInfo, ResourceManager resourceManager, Class<? extends AbstractCas> casInterface)

  - ### setupViewSwitchClassLoaders

    public static <T extends AbstractCas> T setupViewSwitchClassLoaders(CAS cas, boolean sofaAware, ComponentInfo componentInfo, ResourceManager resourceManager, Class<T> casInterface)

  - ### preserveContextHolder

    public static void preserveContextHolder(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, 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, org.apache.uima.internal.util.function.Runnable_withException userCode) throws 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:
      `Exception` - -