code: @SuppressWarnings("unchecked")
      protected <F> F getTemplateObjectFactory(ServiceLocator serviceLocator, Class<F> type, Value<F> defaultValue) {
          Object objectFactoryProperty = this.config.getProperty(MvcFeature.TEMPLATE_OBJECT_FACTORY + this.suffix);
          if (objectFactoryProperty != null) {
              if (type.isAssignableFrom(objectFactoryProperty.getClass())) {
                  return type.cast(objectFactoryProperty);
              }
  
              Class<F> factoryClass = null;
              if (objectFactoryProperty instanceof String) {
                  factoryClass = ReflectionHelper.<F>classForNamePA((String) objectFactoryProperty).run();
              } else if (objectFactoryProperty instanceof Class) {
                  factoryClass = (Class<F>) objectFactoryProperty;
              }
  
              if (factoryClass != null) {
                  if (type.isAssignableFrom(factoryClass)) {
                      return serviceLocator.create(factoryClass);
                  }
  
                  logger.warn(LocalizationMessages.WRONG_TEMPLATE_OBJECT_FACTORY(factoryClass, type));
              }
          }
  
          return defaultValue.get();
      }
docs: <p>getTemplateObjectFactory.</p>
  
  @param serviceLocator a {@link org.glassfish.hk2.api.ServiceLocator} object.
  @param type           a {@link java.lang.Class} object.
  @param defaultValue   a {@link org.glassfish.jersey.internal.util.collection.Value} object.
  @param <F>            a F object.
  @return a F object.