Package org.restlet.engine.converter
Class ConverterUtils
- java.lang.Object
-
- org.restlet.engine.converter.ConverterUtils
-
public class ConverterUtils extends java.lang.ObjectUtilities for the converter service.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateConverterUtils()Private constructor to ensure that the class acts as a true utility class i.e.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ConverterHelpergetBestHelper(java.lang.Object source, Variant target, Resource resource)Returns the best converter helper matching the given parameters.static <T> ConverterHelpergetBestHelper(Representation source, java.lang.Class<T> target, Resource 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.
-
-
-
Method Detail
-
getBestHelper
public static ConverterHelper getBestHelper(java.lang.Object source, Variant target, Resource 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, Resource 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.
-
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.
-
-