Transform the value returned by the controller endpoint.
		
		This extension transforms returned values if the endpoint has a return type annotation.
175819
def transform(self, context, handler, result):
		
		handler = handler.__func__ if hasattr(handler, '__func__') else handler
		annotation = getattr(handler, '__annotations__', {}).get('return', None)
		
		if annotation:
			return (annotation, result)
		
		return result
461335
def apply_transform(key, value, type)
      if type
        if respond_to?("convert_#{type}", true)
          send("convert_#{type}", key, value)
        else
          send(type, value)
        end
      else
        value
      end
    end
1079204
protected BindingResult<T> doConvert(Object value, ArgumentConversionContext<T> context) {
        Optional<T> result = conversionService.convert(value, context);
        if (result.isPresent() && context.getArgument().getType() == Optional.class) {
            return () -> (Optional<T>) result.get();
        }
        return () -> result;
    }
27572
function (data, trans, key) {
			if (typeof data[key] !== "object") {
				throw new SyntaxError('Cannot extend a scalar value.  Transform: ' + util.getTransDescription(trans) + ' Data: ' + JSON.stringify(data));

			}

			for (var prop in trans) {
				if (typeof data[prop] === "object") {
					return extend(data[key], trans[prop], prop);
				}
				data[key][prop] = trans[prop];
			}
		}
1217982
public Object convert(Class<?> targetType, Object value) {
        if (value == null) {
            return null;
        }

        Converter converter = getConverter(value.getClass(), targetType);
        if (converter == null) {
            throw new IllegalArgumentException(
                    "No converter from " + value.getClass() + " to " + targetType.getName());
        } else {
            return converter.convert(targetType, value);
        }
    }
170656
def return_value(nil_values = false, transformation = nil, return_hash = false)
      @value = decode_values
      return @value if @value.first.is_a? String

      if @value.count == 1 && !return_hash
        @value = @value.first['Value']
        @value = transformation.call(@value) if transformation && !@value.nil?
        return @value
      else
        @value = @value.map do |el|
          el['Value'] = transformation.call(el['Value']) if transformation && !el['Value'].nil?
          { key: el['Key'], value: el['Value'] } if el['Value'] || nil_values
        end.compact
      end
    end
179036
def transform(matches, framework, namespace, static_endpoint):
    
    transformed = []
    namespace = namespace + '/' if namespace else ''

    for attribute, elements in matches:
        for element in elements:
            asset_location = get_asset_location(element, attribute)

            # string substitution
            sub_dict = {
                'static_endpoint': static_endpoint, 'namespace': namespace,
                'asset_location': asset_location
                }
            transformed_string = frameworks[framework] % sub_dict

            res = (attribute, element[attribute], transformed_string)
            transformed.append(res)

    return transformed
1245706
private Value deref(Value value)
	{
		if (value instanceof ReferenceValue || value instanceof UpdatableValue
				|| value instanceof TransactionValue)
		{
			return value.deref();
		} else
		{
			return value;
		}
	}
983174
private static <T> T getAnnotationValue(Annotation annotation, String value, Class<T> expectedType) {
        Class<? extends Annotation> annotationType = annotation.annotationType();
        Method valueMethod;
        try {
            valueMethod = annotationType.getDeclaredMethod(value);
        } catch (NoSuchMethodException e) {
            throw new IllegalStateException("Cannot resolve required method '" + value + "()' for '" + annotationType + "'.");
        }
        Object elementValue;
        try {
            elementValue = valueMethod.invoke(annotation);
        } catch (ReflectiveOperationException e) {
            throw new IllegalStateException("Cannot invoke method value() for " + annotationType);
        }
        return elementValue != null ? expectedType.cast(elementValue) : null;
    }
1155531
private static Object transformType(Object value) {
    if (value == null) {
      return null;
    }
    String valueString = value.toString();

    // check for boolean
    boolean boolValue = BooleanUtils.toBoolean(valueString);
    if (StringUtils.equals(valueString, Boolean.toString(boolValue))) {
      return boolValue;
    }

    // check for integer
    int intValue = NumberUtils.toInt(valueString);
    if (StringUtils.equals(valueString, Integer.toString(intValue))) {
      return intValue;
    }

    return value;
  }
626185
def update_value(self, name, value):
        
        if name not in {'id', self.SERVICE_ENDPOINT, self.CONSUME_ENDPOINT, 'type'}:
            self._values[name] = value
784099
def endpoint(self):
        
        if self._endpoint:
            return self._endpoint
        elif self._controller_cls:
            endpoint = f'{snake_case(self._controller_cls.__name__)}.{self.method_name}'
            return endpoint if not self.bp_name else f'{self.bp_name}.{endpoint}'
        elif self.bp_name:
            return f'{self.bp_name}.{self.method_name}'
        return f'{self.view_func.__module__}.{self.method_name}'
1118626
private Object convertParameter(Object value) {
        if (entityInstanceManager.isInstance(value)) {
            return entityInstanceManager.getDatastoreType(value);
        } else if (relationInstanceManager.isInstance(value)) {
            return relationInstanceManager.getDatastoreType(value);
        } else if (value instanceof Collection) {
            Collection collection = (Collection) value;
            List<Object> values = new ArrayList<>();
            for (Object o : collection) {
                values.add(convertParameter(o));
            }
            return values;
        }
        return value;
    }
864719
function ValueMapper(input, options) {
  // Save input for later
  this.input = input;

  // Save placeholder middlewares
  this.middlewares = [];

  // Fallback options
  options = options || {};

  // Add each of the middlewares
  var middlewares = options.middlewares || [];
  middlewares.forEach(this.addMiddleware, this);
}
57225
function getter(value, properties) {
        // Most calculations happen within the typecast and the value passed is typically the value we want to use.
        // Typically, the getter just returns the value.
        // Modifications to the value within the getter are not written to the object.

        // Getter can transform value after typecast.
        if (properties.getter) {
            value = properties.getter.call(this[_privateKey]._root, value);
        }

        return value;
    }
1337970
public SFSDataWrapper transform(Object value) {
        if(value == null)
            return transformNullValue(value);
        return transformNotNullValue(value);
    }
688807
function defaultTransformSuccess(value,options){
    if (options.default === true){
        return {
            status:true,
            data:value
        }
    }
    
    if (options.appendStatus !== false){
        let obj = typeof value == 'object' ? value : {}
        return Object.assign(obj,{status:true})
    }

    return value
}