code: @SuppressWarnings("unchecked")
     private <T extends WorkContext> Class<T> getSupportedWorkContextClass(Class<T> adaptorWorkContext)
     {
        for (Class<? extends WorkContext> supportedWorkContext : SUPPORTED_WORK_CONTEXT_CLASSES)
        {
           // Assignable or not
           if (supportedWorkContext.isAssignableFrom(adaptorWorkContext))
           {
              Class clz = adaptorWorkContext;
  
              while (clz != null)
              {
                 // Supported by the server
                 if (clz.equals(supportedWorkContext))
                 {
                    return clz;
                 }
  
                 clz = clz.getSuperclass();
              }
           }
        }
  
        return null;
     }
docs: Returns work context class if given work context is supported by server,
  returns null instance otherwise.
  
  @param <T> work context class
  @param adaptorWorkContext adaptor supplied work context class
  @return work context class