org.restlet.engine.converter

## Class ConverterUtils

- java.lang.Object
- - org.restlet.engine.converter.ConverterUtils

    public class ConverterUtils
    extends java.lang.Object

Utilities for the converter service.

Author:
  Jerome Louvel

### Method Summary

Methods
`protected static java.util.List<VariantInfo>` `addVariant(java.util.List<VariantInfo> variants, VariantInfo variant)` Adds a variant to the given list.
`static ConverterHelper` `getBestHelper(java.lang.Object source, Variant target, UniformResource resource)` Returns the best converter helper matching the given parameters.
`static <T> ConverterHelper` `getBestHelper(Representation source, java.lang.Class<T> target, UniformResource resource)` Returns the best converter helper matching the given parameters.
`static java.util.List<VariantInfo>` `getVariants(java.lang.Class<?> sourceClass, Variant targetVariant)` Returns the list of variants that can be converted from a given object class.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### addVariant

    protected static java.util.List<VariantInfo> addVariant(java.util.List<VariantInfo> variants,
                                         VariantInfo variant)

Adds a variant to the given list.

Parameters:
  `variants` - The list to update.
  `variant` - The variant info to add.
Returns:
  The updated list.

#### getVariants

    public static java.util.List<VariantInfo> getVariants(java.lang.Class<?> sourceClass,
                                          Variant targetVariant)

Returns the list of variants that can be converted from a given object class.

Parameters:
  `sourceClass` - The source class.
  `targetVariant` - The expected representation metadata.
Returns:
  The list of variants that can be converted.

#### getBestHelper

    public static ConverterHelper getBestHelper(java.lang.Object source,
                                Variant target,
                                UniformResource resource)

Returns the best converter helper matching the given parameters.

Parameters:
  `source` - The object to convert to a representation.
  `target` - The target representation variant.
  `resource` - The optional parent resource.
Returns:
  The matched converter helper or null.

#### getBestHelper

    public static <T> ConverterHelper getBestHelper(Representation source,
                                    java.lang.Class<T> target,
                                    UniformResource resource)

Returns the best converter helper matching the given parameters.

Type Parameters:
  `T` - The target class.
Parameters:
  `source` - The source representation variant.
  `target` - The target class.
  `resource` - The parent resource.
Returns:
  The matched converter helper or null.