Adds a type transformer applied at runtime.
This method handles transformations to String from GString,
array transformations and number based transformations
483089
protected static MethodHandle addTransformer(MethodHandle handle, int pos, Object arg, Class parameter) {
        MethodHandle transformer=null;
        if (arg instanceof GString) {
            transformer = TO_STRING;
        } else if (arg instanceof Closure) {
            transformer = createSAMTransform(arg, parameter);
        } else if (Number.class.isAssignableFrom(parameter)) {
            transformer = selectNumberTransformer(parameter, arg);
        } else if (parameter.isArray()) {
            transformer =  MethodHandles.insertArguments(AS_ARRAY, 1, parameter);
        }
        if (transformer==null) throw new GroovyBugError("Unknown transformation for argument "+arg+" at position "+pos+" with "+arg.getClass()+" for parameter of type "+parameter);
        return applyUnsharpFilter(handle, pos, transformer);
    }
863437
def _multi_string_put_transform(cls, item, **kwargs):
        '''
        
        '''
        if isinstance(item, list):
            return item
        elif isinstance(item, six.string_types):
            if item.lower() == 'not defined':
                return None
            else:
                return item.split(',')
        else:
            return 'Invalid Value'
261017
function transformType (type) {
  if (Array.isArray(type)) {
    return transformArray(type)
  }

  if (typeof type === 'object') {
    return transformObject(type)
  }

  if (
    typeof type === 'function' &&
    (!type.prototype || type.name === '')
  ) {
    return type
  }

  return findType(type)
}
865068
private Map<TemplateType, JSType> evaluateTypeTransformations(
      ImmutableList<TemplateType> templateTypes,
      Map<TemplateType, JSType> inferredTypes,
      FlowScope scope) {

    Map<String, JSType> typeVars = null;
    Map<TemplateType, JSType> result = null;
    TypeTransformation ttlObj = null;

    for (TemplateType type : templateTypes) {
      if (type.isTypeTransformation()) {
        // Lazy initialization when the first type transformation is found
        if (ttlObj == null) {
          ttlObj = new TypeTransformation(compiler, scope.getDeclarationScope());
          typeVars = buildTypeVariables(inferredTypes);
          result = new LinkedHashMap<>();
        }
        // Evaluate the type transformation expression using the current
        // known types for the template type variables
        JSType transformedType = ttlObj.eval(
            type.getTypeTransformation(),
            ImmutableMap.copyOf(typeVars));
        result.put(type, transformedType);
        // Add the transformed type to the type variables
        typeVars.put(type.getReferenceName(), transformedType);
      }
    }
    return result;
  }
1144324
private void addFileToTransform(Map<Transformer,Map<String,Set<URI>>> gs, Transformer t, Source s) {
        Map<String,Set<URI>> fs = gs.get(t);
        if (fs == null) {
            fs = new HashMap<String,Set<URI>>();
            gs.put(t, fs);
        }
        Set<URI> ss = fs.get(s.pkg().name());
        if (ss == null) {
            ss = new HashSet<URI>();
            fs.put(s.pkg().name(), ss);
        }
        ss.add(s.file().toURI());
    }
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);
    }
  }
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);
  }
1364363
protected void initWithWrapperType() {
     // =========== wrapper type ==============
        transformers.put(Boolean.class, new Transformer() {
            @Override
            public SFSDataWrapper transform(Object value) {
                return new SFSDataWrapper(SFSDataType.BOOL, value);
            }
        });
        transformers.put(Byte.class, new Transformer() {
            @Override
            public SFSDataWrapper transform(Object value) {
                return new SFSDataWrapper(SFSDataType.BYTE, value);
            }
        });
        transformers.put(Character.class, new Transformer() {
            @Override
            public SFSDataWrapper transform(Object value) {
                return new SFSDataWrapper(SFSDataType.BYTE, (byte)((Character)value).charValue());
            }
        });
        transformers.put(Double.class, new Transformer() {
            @Override
            public SFSDataWrapper transform(Object value) {
                return new SFSDataWrapper(SFSDataType.DOUBLE, value);
            }
        });
        transformers.put(Float.class, new Transformer() {
            @Override
            public SFSDataWrapper transform(Object value) {
                return new SFSDataWrapper(SFSDataType.FLOAT, value);
            }
        });
        transformers.put(Integer.class, new Transformer() {
            @Override
            public SFSDataWrapper transform(Object value) {
                return new SFSDataWrapper(SFSDataType.INT, value);
            }
        });
        transformers.put(Long.class, new Transformer() {
            @Override
            public SFSDataWrapper transform(Object value) {
                return new SFSDataWrapper(SFSDataType.LONG, value);
            }
        });
        transformers.put(Short.class, new Transformer() {
            @Override
            public SFSDataWrapper transform(Object value) {
                return new SFSDataWrapper(SFSDataType.SHORT, value);
            }
        });
    }
671674
private void addTypeAliasNodelets() {
        parser.setXpath("/aspectran/typeAliases");
        parser.addNodeEndlet(text -> {
            if (StringUtils.hasLength(text)) {
                Parameters parameters = new VariableParameters(text);
                for (String alias : parameters.getParameterNameSet()) {
                    assistant.addTypeAlias(alias, parameters.getString(alias));
                }
            }
        });
        parser.setXpath("/aspectran/typeAliases/typeAlias");
        parser.addNodelet(attrs -> {
            String alias = attrs.get("alias");
            String type = attrs.get("type");

            assistant.addTypeAlias(alias, type);
        });
    }
350107
private static synchronized void addTransformer() {
        if (detailedTransformTrace && tc.isEntryEnabled())
            Tr.entry(tc, "addTransformer");

        if (registeredTransformer == null && instrumentation != null) {
            registeredTransformer = new LibertyJava8WorkaroundRuntimeTransformer();
            instrumentation.addTransformer(registeredTransformer, false);
        }

        if (detailedTransformTrace && tc.isEntryEnabled())
            Tr.exit(tc, "addTransformer");
    }
949012
private void addTypeSubstitutions(Map<Wrapper<ExprNode>, SoyType> substitutionsToAdd) {
    for (Map.Entry<Wrapper<ExprNode>, SoyType> entry : substitutionsToAdd.entrySet()) {
      ExprNode expr = entry.getKey().get();
      // Get the existing type
      SoyType previousType = expr.getType();
      for (TypeSubstitution subst = substitutions; subst != null; subst = subst.parent) {
        if (ExprEquivalence.get().equivalent(subst.expression, expr)) {
          previousType = subst.type;
          break;
        }
      }

      // If the new type is different than the current type, then add a new type substitution.
      if (!entry.getValue().equals(previousType)) {
        substitutions = new TypeSubstitution(substitutions, expr, entry.getValue());
      }
    }
  }
955939
function applyTransformers(options, state, file) {
    var transformationSucceededAtLeastOnce = false;
    if (options.transformations && state.ext == "js") {
        options.transformations.forEach(function (transformation) {
            transformationSucceededAtLeastOnce |= transformAndTest(transformation, options, state, file);
        });
    }
    return transformationSucceededAtLeastOnce;
}
138833
function transformFactory(methods) {
  var length = methods.length

  return transformer

  // Transformer.
  function transformer(cst) {
    visit(cst, visitor)
  }

  function visitor(node, position, parent) {
    var index = -1

    if (node.type === punctuation || node.type === symbol) {
      while (++index < length) {
        methods[index](node, position, parent)
      }
    }
  }
}
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);
    }
796139
protected <T> void addConverter(Class<T> type, Converter<T> converter) {
        storage.put(type, converter);
    }
893186
def set_transform_interface_params(spec, input_features, output_features, are_optional = False):
    
    input_features = _fm.process_or_validate_features(input_features)
    output_features = _fm.process_or_validate_features(output_features)

    # Add input and output features
    for (fname, ftype) in input_features:
        input_ = spec.description.input.add()
        input_.name = fname
        datatypes._set_datatype(input_.type, ftype)
        if are_optional:
            input_.type.isOptional = are_optional

    for (fname, ftype) in output_features:
        output_ = spec.description.output.add()
        output_.name = fname
        datatypes._set_datatype(output_.type, ftype)

    return spec
1052218
static BindTransform getLanguageTransform(TypeName type) {
		String typeName = type.toString();

		if (Integer.class.getCanonicalName().equals(typeName)) {
			return new IntegerBindTransform(true);
		}
		if (Boolean.class.getCanonicalName().equals(typeName)) {
			return new BooleanBindTransform(true);
		}
		if (Long.class.getCanonicalName().equals(typeName)) {
			return new LongBindTransform(true);
		}
		if (Double.class.getCanonicalName().equals(typeName)) {
			return new DoubleBindTransform(true);
		}
		if (Float.class.getCanonicalName().equals(typeName)) {
			return new FloatBindTransform(true);
		}
		if (Short.class.getCanonicalName().equals(typeName)) {
			return new ShortBindTransform(true);
		}
		if (Byte.class.getCanonicalName().equals(typeName)) {
			return new ByteBindTransform(true);
		}
		if (Character.class.getCanonicalName().equals(typeName)) {
			return new CharacterBindTransform(true);
		}
		if (String.class.getCanonicalName().equals(typeName)) {
			return new StringBindTransform();
		}
		return null;
	}