/* (non-Javadoc)
@see retrofit2.Converter#convert(java.lang.Object)
189790
@SuppressWarnings({ "unchecked", "rawtypes" })
	@Override
	public RequestBody convert(T value) throws IOException {
		Buffer buffer = new Buffer();	
		
		try {	
			binderContext.serializeCollection((Collection) value, (Class)clazz,buffer.outputStream()); 			
			return RequestBody.create(MEDIA_TYPE, buffer.readByteString());
		} catch (Exception e) {			
			e.printStackTrace();
			return null;
		} finally
		{
			buffer.close();
		}
		
		
	}
1256386
@SuppressWarnings("unchecked")
	public static <T> T convertByClassName(String className, Object value) throws ConvertException{
		return (T) convert(ClassUtil.loadClass(className), value);
	}
305806
public static <T> T convert(Object from, Class<? extends T> to, Params arg) {
        if (from == null) {
            throw new NullPointerException("from");
        }
        if (to == null) {
            throw new NullPointerException("to");
        }
        if (from.getClass() == String.class && to.isArray()) {
            return new ArrayConverter((String) from).getArrayForType(to);
        }
        // get it from the internal cache.
        @SuppressWarnings("unchecked")
        Converter<Object, T> c = co.get(key(from.getClass(), to));
        if (c == null) {
            // service provider lookup
            c = lookupConversionService(from.getClass(), to);
            if (c == null) {
                throw new ComponentException("No Converter: " + from + " (" + from.getClass() + ") -> " + to);
            }
            co.put(key(from.getClass(), to), c);
        }
        Object param = null;
        if (arg != null) {
            param = arg.get(from.getClass(), to);
        }
        return (T) c.convert(from, param);
    }
402509
function convertObject(obj){
        var lookup, value;

        if(!canConvertType(obj)){
            return;
        }

        lookup = obj.__observable__;

        if(lookup && lookup.__full__){
            return;
        }

        lookup = lookup || (obj.__observable__ = {});
        lookup.__full__ = true;

        if (system.isArray(obj)) {
            var observable = ko.observableArray(obj);
            makeObservableArray(obj, observable);
        } else {
            for (var propertyName in obj) {
                if(shouldIgnorePropertyName(propertyName)){
                    continue;
                }

                if(!lookup[propertyName]){
                    value = obj[propertyName];

                    if(!system.isFunction(value)){
                        convertProperty(obj, propertyName, value);
                    }
                }
            }
        }

        if(logConversion) {
            system.log('Converted', obj);
        }
    }
447594
@Override
    public Object convert(Object value) {
       if(value instanceof Element) {
           return parseXmlElement((Element) value);
       }
       if(value instanceof CompositeData) {
           return toMap((CompositeData)value);
       }
       return value;
    }
191607
protected Object convertFieldValue(Schema outputSchema, Field field, GenericRecord inputRecord,
      WorkUnitState workUnit)
      throws DataConversionException {
    if (field.name().equals(payloadField)) {
      return upConvertPayload(inputRecord);
    }
    return inputRecord.get(field.name());
  }
1177036
@Override
	public Object convert(Object source) {

		NodeInterface relatedNode = getRelatedNode(true);
		if (relatedNode != null) {

			try {
				
				relatedNode.setProperty(targetKey, source);
				
			} catch (FrameworkException fex) {

				logger.warn("Unable to set remote node property {}", targetKey);
			}
		}
		
		return null;
	}
1105397
@Override
    public String convertTo(final Object value) {
        if (value == null) return "null";
        return convertTo(value.getClass(), value);
    }
1186900
private <A extends Annotation> AnnotationConverter<A> getConverter(Annotation annotation) {
		MappingOption mappingOption = annotation.annotationType().getAnnotation( MappingOption.class );
		if ( mappingOption == null ) {
			return null;
		}

		// wrong type would be a programming error of the annotation developer
		@SuppressWarnings("unchecked")
		Class<? extends AnnotationConverter<A>> converterClass = (Class<? extends AnnotationConverter<A>>) mappingOption.value();

		try {
			return converterClass.newInstance();
		}
		catch (Exception e) {
			throw log.cannotConvertAnnotation( converterClass, e );
		}
	}
234112
protected final Object convert(Class targetType, String value) {
        Converter converter = Stapler.lookupConverter(targetType);
        if (converter==null)
            throw new IllegalArgumentException("Unable to convert to "+targetType);

        return converter.convert(targetType,value);
    }
403863
@SuppressWarnings("unchecked")
    private static <T> Converter<Object, T> lookupConversionService(Class from, Class to) {
        for (ConversionProvider converter : convServices) {
            Converter c = converter.getConverter(from, to);
            if (c != null) {
                return c;
            }
        }
        return null;
    }
1010025
public static <T> T convert(Object source, Class<T> destType) {
        return JSON.convertValue(source, destType);
    }
663904
@Override
  public UnitValue convert(UnitValue value, Unit target) {
    Unit src = value.unit();
    UnitCategory category = src.category();
    if (src == target || category != target.category()) {
      return value;
    }
    
    switch (category) {
      case CONCENTR:
      case LIGHT:
        // Not available
        break;

      case CONSUMPTION:
        return consumption(value, target);

      case TEMPERATURE:
        return temperature(value, target);
        
      case VOLUME:
        if (measurementSystem == MeasurementSystem.UK) {
          return convert(value, target, UnitFactors.VOLUME_UK);
        }
        return convert(value, target, UnitFactors.VOLUME);
        
      default:
        UnitFactorMap factors = FACTORS_MAP.get(category);
        if (factors != null) {
          return convert(value, target, factors);
        }
        break;
    }
    
    return value;
  }
571063
private <T> T convertObject(byte[] json, Class<T> claz) throws IOException {
        TypeReference<RestSuccessResult<Map<?, ?>>> typeReference = new TypeReference<RestSuccessResult<Map<?, ?>>>() {
        };
        RestSuccessResult<T> successResponse = MAPPER.readValue(json, typeReference);
        Map<?, ?> data = (Map<?, ?>) successResponse.getData();
        return MAPPER.convertValue(data, claz);
    }
333745
public <T> T convert(Object value, Class<T> clazz) {
    if (null == value) return null;
    if (value instanceof String && Strings.isEmpty((String) value)) { return null; }
    if (value.getClass().isArray()) {
      Object[] values = (Object[]) value;
      if (values.length >= 1) {
        value = values[0];
      }
    }
    return conversion.convert(value, clazz);
  }
394682
public <T> T convert(ConversionContext context, Object source,
			TypeReference<T> destinationType) throws ConverterException {
		try {
			return (T) multiConverter.convert(context, source, destinationType);
		} catch (ConverterException e) {
			throw e;
		} catch (Exception e) {
			// There is a problem with one converter. This should not happen.
			// Either there is a bug in this converter or it is not properly
			// configured
			throw new ConverterException(
					MessageFormat
							.format(
									"Could not convert given object with class ''{0}'' to object with type signature ''{1}''",
									source == null ? "null" : source.getClass()
											.getName(), destinationType), e);
		}
	}
21221
@Override
    public Object convertRequest(ServiceRequestContext ctx, AggregatedHttpMessage request,
                                 Class<?> expectedResultType) throws Exception {
        if (expectedResultType == String.class ||
            expectedResultType == CharSequence.class) {
            final MediaType contentType = request.contentType();
            if (contentType != null && contentType.is(MediaType.ANY_TEXT_TYPE)) {
                return request.content(
                        contentType.charset().orElse(ArmeriaHttpUtil.HTTP_DEFAULT_CONTENT_CHARSET));
            }
        }
        return RequestConverterFunction.fallthrough();
    }