Get a fresh transformer to use for XSLT transformations (and by
implication serialization and XPaths).
@return a new instance of the default transformer factory
973568
static TransformerFactory newTransformerFactory() {
        TransformerFactory tf = TransformerFactory.newInstance();
        if (uriResolver != null) {
            tf.setURIResolver(uriResolver);
        }
        if (enableXXEProtection) {
            tf = TransformerFactoryConfigurer.Default.configure(tf);
        }
        return tf;
    }
78647
protected Transformer createXmlTransformer(int numberOfBlanksToIndent) throws TransformerConfigurationException {
        TransformerFactoryConfigurer.Builder b = TransformerFactoryConfigurer.builder()
            .withExternalStylesheetLoadingDisabled()
            .withDTDLoadingDisabled();

        if (numberOfBlanksToIndent >= 0) {
            // not all TransformerFactories support this feature
            b = b.withSafeAttribute("indent-number", numberOfBlanksToIndent);
        }
        final TransformerFactory factory = b.build().configure(TransformerFactory.newInstance());
        final Transformer transformer = factory.newTransformer();
        transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
        transformer.setOutputProperty(OutputKeys.METHOD, "xml");
        if (numberOfBlanksToIndent >= 0) {
            try {
                transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", String
                    .valueOf(numberOfBlanksToIndent));
            } catch (final IllegalArgumentException ex) {
                // Could not set property '{http://xml.apache.org/xslt}indent-amount' on
                // transformer.getClass().getName()
                // which is fine for us
            }
            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
        }
        return transformer;
    }
1187612
public FacesConfigRendererType<FacesConfigRenderKitType<T>> getOrCreateRenderer()
   {
      List<Node> nodeList = childNode.get("renderer");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new FacesConfigRendererTypeImpl<FacesConfigRenderKitType<T>>(this, "renderer", childNode, nodeList.get(0));
      }
      return createRenderer();
   }
1356150
public FacesConfigFacetType<FacesConfigRendererType<T>> getOrCreateFacet()
   {
      List<Node> nodeList = childNode.get("facet");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new FacesConfigFacetTypeImpl<FacesConfigRendererType<T>>(this, "facet", childNode, nodeList.get(0));
      }
      return createFacet();
   }
635255
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ InputSource.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return InputSource.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
                                  (ContentHandle<C>) new InputSourceHandle() : null;
        return handle;
      }
    };
  }
1297168
public static SOAPElementFactory newInstance() throws SOAPException {
        try {
            return new SOAPElementFactory(SOAPFactory.newInstance());
        } catch (Exception ex) {
            throw new SOAPException(
                "Unable to create SOAP Element Factory: " + ex.getMessage());
        }
    }
308151
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ JsonElement.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return JsonElement.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
          (ContentHandle<C>) new GSONHandle() : null;
        return handle;
      }
    };
  }
274181
private Transformer createTransformer(boolean indent) {

    try {
      Transformer result = this.transformerFactory.newTransformer();
      if (indent) {
        result.setOutputProperty(OutputKeys.INDENT, "yes");
      }
      return result;
    } catch (TransformerConfigurationException e) {
      throw new IllegalStateException("XML Transformer misconfigured!" + " Probably your JVM does not support the required JAXP version!", e);
    }
  }
1216243
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ XMLStreamReader.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return XMLStreamReader.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
                                  (ContentHandle<C>) new XMLStreamReaderHandle() : null;
        return handle;
      }
    };
  }
435149
public XMLFilter newXMLFilter(Templates templates)
          throws TransformerConfigurationException
  {
    try 
    {
      return new TrAXFilter(templates);
    } 
    catch( TransformerConfigurationException ex ) 
    {
      if( m_errorListener != null) 
      {
        try 
        {
          m_errorListener.fatalError( ex );
          return null;
        } 
        catch( TransformerConfigurationException ex1 ) 
        {
          throw ex1;
        }
        catch( TransformerException ex1 ) 
        {
          throw new TransformerConfigurationException(ex1);
        }
      }
      throw ex;
    }
  }
1139339
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ XMLEventReader.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return XMLEventReader.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
                                  (ContentHandle<C>) new XMLEventReaderHandle() : null;
        return handle;
      }
    };
  }
1365079
private static XmlPullParser getXmlPullParser() {
        SoftReference<XmlPullParser> ref = XPP_PARSER.get();
        XmlPullParser result = ref.get();
        if (result == null) {
            Exception thrown;
            try {
                XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
                factory.setNamespaceAware(true);
                factory.setValidating(false);
                result = factory.newPullParser();
                ref = new SoftReference<XmlPullParser>(result);
                XPP_PARSER.set(ref);
                return result;
            } catch (Exception ex) {
                thrown = ex;
            }
            throw(new IllegalStateException(
                    "Could not create XmlPull parser", thrown));
        } else {
            return result;
        }
    }
911422
public static <T> Observable.Transformer<T,ImmutableSet<T>> toImmutableSet() {
        return new Observable.Transformer<T, ImmutableSet<T>>() {
            @Override
            public Observable<ImmutableSet<T>> call(Observable<T> source) {
                return source.collect(new Func0<ImmutableSet.Builder<T>>() {
                    @Override
                    public ImmutableSet.Builder<T> call() {
                        return ImmutableSet.builder();
                    }
                }, new Action2<ImmutableSet.Builder<T>, T>() {
                    @Override
                    public void call(ImmutableSet.Builder<T> builder, T t) {
                        builder.add(t);
                    }
                })
                .map(new Func1<ImmutableSet.Builder<T>, ImmutableSet<T>>() {
                    @Override
                    public ImmutableSet<T> call(ImmutableSet.Builder<T> builder) {
                        return builder.build();
                    }
                });
            }
        };
    }
40152
public synchronized <U> Versioned<U> map(Function<V, U> transformer) {
    return new Versioned<>(value != null ? transformer.apply(value) : null, version, creationTime);
  }
80743
public Converter<EntityMappings<T>> getOrCreateConverter()
   {
      List<Node> nodeList = childNode.get("converter");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new ConverterImpl<EntityMappings<T>>(this, "converter", childNode, nodeList.get(0));
      }
      return createConverter();
   }
370142
private static XMLInputFactory getXMLInputFactory() {
        if (SAFE_INPUT_FACTORY != null) {
            return SAFE_INPUT_FACTORY;
        }
        XMLInputFactory f = NS_AWARE_INPUT_FACTORY_POOL.poll();
        if (f == null) {
            f = createXMLInputFactory(true);
        }
        return f;
    }
160919
protected function getTransformerFromClassProperty()
	{
		if (! isset($this->transformer) || ! $this->isTransformer($this->transformer)) {
			throw new \InvalidArgumentException('You cannot transform the entity without providing a valid Transformer. Verify your transformer extends ' . TransformerAbstract::class);
		}


		return (is_a($this->transformer, TransformerAbstract::class, true) && ! is_object($this->transformer)) ?
			new $this->transformer : $this->transformer;
	}