Creates a new DocumentBuilder instance using the provided DocumentBuilderFactory

@param factory
@return
323546
public static DocumentBuilder newDocumentBuilder(final DocumentBuilderFactory factory)
   {
      try
      {
         final DocumentBuilder builder = factory.newDocumentBuilder();
         return builder;
      }
      catch (Exception e)
      {
         throw MESSAGES.unableToCreateInstanceOf(e, DocumentBuilder.class.getName());
      }
   }
7433
@NotNull
    public static DocumentBuilder createDocumentBuilder() {
        try {
            final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            factory.setNamespaceAware(true);
            return factory.newDocumentBuilder();
        } catch (final ParserConfigurationException ex) {
            throw new RuntimeException("Couldn't create document builder", ex);
        }
    }
601403
public static DocumentFactory getInstance() {
      if (CONFIGURED_INSTANCE == null) {
         synchronized (DocumentFactory.class) {
            if (CONFIGURED_INSTANCE == null) {
               CONFIGURED_INSTANCE = new DocumentFactory();
            }
         }
      }
      return CONFIGURED_INSTANCE;
   }
1168796
public static FormatFactory factory()
    {

        return new FormatFactory()
        {
            @Override
            public Format getFormat(String name, String args, Locale locale)
            {
                Map<String, Format> mt = FormatTables.get(name);
                Preconditions.checkArgument(mt != null, "There's no format instance for [%s]", name);

                Format m = mt.get((args == null || args.length() < 1) ? FormatNames.DEFAULT : args);
                Preconditions.checkArgument(m != null, "There's no signature in [%s] for the given args [%s]", name,
                        args);

                return ((ConfigurableFormat) m).withLocale(locale);
            }
        };

    }
357721
private void returnDocumentBuilderToPool(DocumentBuilder db) {
        try {
            db.reset();
            documentBuilderPool.offerFirst(db);
        } catch (UnsupportedOperationException e) {
            // document builders that don't support reset() can't be pooled
        }
    }
324192
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ Document.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return Document.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
          (ContentHandle<C>) new DOM4JHandle() : null;
        return handle;
      }
    };
  }
873785
public B contentPreviewerFactory(ContentPreviewerFactory factory) {
        requireNonNull(factory, "factory");
        requestContentPreviewerFactory(factory);
        responseContentPreviewerFactory(factory);
        return self();
    }
35215
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ JsonParser.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return JsonParser.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
                                  (ContentHandle<C>) new JacksonParserHandle() : null;
        return handle;
      }
    };
  }
863605
public static DocumentBuilderFactory getStandardDocumentBuilderFactory(boolean validating) {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

        try {
            // enable validation (must specify a grammar)
            dbf.setValidating(validating);
            dbf.setFeature("http://xml.org/sax/features/validation", validating);

            dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", validating);
            dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", validating);

            dbf.setFeature("http://apache.org/xml/features/validation/schema", true);
            dbf.setFeature("http://xml.org/sax/features/namespaces", true);

            dbf.setFeature("http://apache.org/xml/features/dom/include-ignorable-whitespace", false);
        } catch (ParserConfigurationException pce) {
            throw new RuntimeException("Cannot load standard DocumentBuilderFactory. " + pce.getMessage(), pce);
        }

        dbf.setNamespaceAware(true);
        dbf.setIgnoringComments(true);
        dbf.setExpandEntityReferences(true);

        return dbf;
    }
10377
public JdbcMapperFactory getterFactory(final GetterFactory<ResultSet, JdbcColumnKey> getterFactory) {
		return addGetterFactory(new ContextualGetterFactoryAdapter<ResultSet, JdbcColumnKey>(getterFactory));
	}
508480
public static MethodBuilder getInstance(Context context,
            TypeElement typeElement, MethodWriter writer) {
        return new MethodBuilder(context, typeElement, writer);
    }
95831
protected BindingFactory createIdeaBindings() {
		final BindingFactory factory = new BindingFactory(getClass().getName());
		for (final AbstractSubCodeBuilderFragment subFragment : this.subFragments) {
			subFragment.generateIdeaBindings(factory);
		}
		return factory;
	}
428011
private static <T> ServiceBindingBuilder<T> newFactoryBinder(final Factory<T> factory) {
        return BindingBuilderFactory.newFactoryBinder(factory);
    }
416886
public static FieldBuilder getInstance(Context context,
            ClassDoc classDoc,
            FieldWriter writer) {
        return new FieldBuilder(context, classDoc, writer);
    }
1136367
public static synchronized DocumentBuilder createDocumentBuilder() {
        DocumentBuilder result;
        try {
            result = FACTORY_NON_VALIDATING.newDocumentBuilder();
        } catch (ParserConfigurationException e) {
            throw new RuntimeException("createDocumentBuilder failed", e);
        }
        result.setErrorHandler(ERROR_HANDLER);
        return result;
    }
1120151
private static DocumentBuilder constructDocumentBuilder(List<SAXParseException> errors)
            throws ParserConfigurationException {

        DocumentBuilderFactory documentBuilderFactory = constructDocumentBuilderFactory();
        DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
        docBuilder.setEntityResolver(new BindingXmlEntityResolver());
        docBuilder.setErrorHandler(new BindingXmlErrorHandler(errors));
        return docBuilder;
    }
1054791
public RestTemplateBuilder requestFactory(
			Class<? extends ClientHttpRequestFactory> requestFactory) {
		Assert.notNull(requestFactory, "RequestFactory must not be null");
		return requestFactory(() -> createRequestFactory(requestFactory));
	}