/*
(non-Javadoc)

@see
org.springframework.data.domain.Slice#transform(org.springframework.core.convert.converter.
Converter)
438538
@Override
  public <U> Slice<U> map(final Function<? super T, ? extends U> converter) {
    return new SliceImpl<>(this.getConvertedContent(converter), this.pageable, this.hasNext);
  }
114605
public Response transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] origBytes) throws IllegalClassFormatException {

    byte[] transformed = first.transform(loader, className, classBeingRedefined, protectionDomain, origBytes);

    boolean firstEnhanced = (transformed != null);
    byte[] nextBytes = (transformed != null) ? transformed : origBytes;
    byte[] finalTransformed = second.transform(loader, className, classBeingRedefined, protectionDomain, nextBytes);

    if (finalTransformed != null) {
      return new Response(finalTransformed, firstEnhanced, true);

    } else if (transformed != null) {
      return new Response(transformed, firstEnhanced, false);
    }
    return Response.NOT_TRANSFORMED;
  }
540341
public TreeBuilder<T> convert(ContentConverter<T> converter, Path path) {
        return convert(converter, PathUtil.subpathSelector(path));
    }
991884
@Override
    public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined,
            ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {

        ClassReader cr = new ClassReader(classfileBuffer);
        ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_FRAMES);
        ClassVisitor cv = new ClassAdapter(cw);
        cr.accept(cv, ClassReader.SKIP_FRAMES);
        return cw.toByteArray();
    }
758413
protected boolean transform(IResource resource) throws Exception {
        String name = StringUtils.trimToEmpty(resource.getSourcePath());
        
        if (resource.isDirectory() || mojo.isExcluded(name)) {
            return false;
        }
        
        AbstractTransform transform = getTransform(name);
        String targetPath = transform == null ? null : transform.getTargetPath(resource);
        
        if (targetPath != null) {
            File out = mojo.newStagingFile(relocateResource(targetPath), resource.getTime());
            try (OutputStream outputStream = new FileOutputStream(out);) {
                transform.transform(resource, outputStream);
                return true;
            }
        }
        
        return false;
    }
115889
@Nullable
	protected <T> T convert(Object source, Class<T> targetType) {
		return this.conversionService.convert(source, targetType);
	}
360894
private void transform(final String xml, final UIContext uic, final PrintWriter writer) {

		Transformer transformer = newTransformer();
		Source inputXml;
		try {
			inputXml = new StreamSource(new ByteArrayInputStream(xml.getBytes("utf-8")));
			StreamResult result = new StreamResult(writer);
			if (debugRequested) {
				transformer.setParameter("isDebug", 1);
			}
			transformer.transform(inputXml, result);
		} catch (UnsupportedEncodingException | TransformerException ex) {
			throw new SystemException("Could not transform xml", ex);
		}
	}
165769
@Override
    public DigitalObject transform(DigitalObject in, String jsonConfig)
            throws TransformerException {
        if (!valid) {
            error("Instantiation did not complete.");
        }
        log.debug("Received OID '{}'", in.getId());
        return process(in, jsonConfig);
    }
1310269
public static Transformer newTransformer(Source source, JstlUriResolver uriResolver) throws TransformerConfigurationException {
        TRANSFORMER_FACTORY.setURIResolver(uriResolver);
        Transformer transformer = TRANSFORMER_FACTORY.newTransformer(source);
        // Although newTansformer() is not allowed to return null, Xalan does.
        // Trap that here by throwing the expected TransformerConfigurationException.
        if (transformer == null) {
            throw new TransformerConfigurationException("newTransformer returned null. XSLT may be invalid.");
        }
        return transformer;
    }
147066
public static <T,K,V> Observable.Transformer<T,ImmutableMap<K,V>> toImmutableMap(final Func1<T,K> keyMapper, final Func1<T,V> valueMapper) {
        return new Observable.Transformer<T,ImmutableMap<K,V>>() {
            @Override
            public Observable<ImmutableMap<K, V>> call(Observable<T> observable) {
                return observable.collect(new Func0<ImmutableMap.Builder<K, V>>() {
                    @Override
                    public ImmutableMap.Builder<K, V> call() {
                        return ImmutableMap.builder();
                    }
                }, new Action2<ImmutableMap.Builder<K, V>, T>() {
                    @Override
                    public void call(ImmutableMap.Builder<K, V> builder, T t) {
                        builder.put(keyMapper.call(t), valueMapper.call(t));
                    }
                })
                .map(new Func1<ImmutableMap.Builder<K, V>, ImmutableMap<K, V>>() {
                    @Override
                    public ImmutableMap<K, V> call(ImmutableMap.Builder<K, V> builder) {
                        return builder.build();
                    }
                });
            }
        };
    }
629858
@Override
    public byte[] transform(ClassLoader loader,
                            String className,
                            Class<?> classBeingRedefined,
                            ProtectionDomain protectionDomain,
                            byte[] classfileBuffer) throws IllegalClassFormatException {
        byte[] transformedBytes = providerClassTransformer.transform(loader, className, classBeingRedefined, protectionDomain, classfileBuffer);

        try {
            // Capture bytecode to disk if capturing is enabled and if a transformation has occurred.
            // The transform() method contract states a return value of null indicates no transformation.
            // We check the returned byte array just in case the JPA Implementation violates that contract.
            if (captureEnabled && transformedBytes != null) {
                File saveFile = new File(captureRootDir, className.replace('.', '/') + ".class");
                File targetDir = saveFile.getParentFile();

                if (mkdirs(targetDir)) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Capturing enhanced Entity Class bytecode to " + saveFile.getAbsolutePath());
                    }

                    writeCapturedEnhancedBytecode(saveFile, transformedBytes);
                } else {
                    // Couldn't create the target directory
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Failed to create capture directory " + targetDir.getAbsolutePath());
                    }
                }
            }
        } catch (Throwable t) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Caught unexpected Exception while capturing " + className + ".", t);
            }
        }

        return transformedBytes;
    }
285918
public static <T1, T2> T2 transform(T1 object, Class<T2> typeClass) {
        try {
            return jsonMapper.convertValue(object, typeClass);
        } catch (Exception e) {
            return JMExceptionManager.handleExceptionAndReturnNull(log, e,
                    "transform", object);
        }
    }
148556
@Requires({
    "code != null",
    "lineNumbers != null",
    "code.size() == lineNumbers.size()"
  })
  protected boolean transform(List<String> code, List<Long> lineNumbers,
                              Object sourceInfo) {
    return transformer.transform(code, lineNumbers, sourceInfo);
  }
307689
public void transform( InputStream xmlIS,
                           InputStream xslIS,
                           Map params,
                           OutputStream result,
                           String encoding) {
        try {
            TransformerFactory trFac = TransformerFactory.newInstance();
            Transformer transformer = trFac.newTransformer(new StreamSource(xslIS));
            Iterator it = params.keySet().iterator();
            while (it.hasNext()) {
                String key = (String)it.next();
                transformer.setParameter(key, (String)params.get(key));
            }
            transformer.setOutputProperty("encoding", encoding);
            transformer.transform(new StreamSource(xmlIS), new StreamResult(result));
        } catch (Exception e) {
            getLogger().severe("XmlHttpProxy: Exception with xslt " + e);
        }
    }
1129835
private static void _transform(Source source, Result out) throws TransformerException {
        TransformerFactory factory = TransformerFactory.newInstance();
        factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);

        // this allows us to use UTF-8 for storing data,
        // plus it checks any well-formedness issue in the submitted data.
        Transformer t = factory.newTransformer();
        t.transform(source, out);
    }
116258
public static <T1, T2> T2 transform(T1 object,
            TypeReference<T2> typeReference) {
        try {
            return jsonMapper.convertValue(object, typeReference);
        } catch (Exception e) {
            return JMExceptionManager.handleExceptionAndReturnNull(log, e,
                    "transform", object);
        }
    }
841227
public Object transform( int to, Object input, Map<String, Object> context ) {
        return transform( 0, to, input, context );
    }