All Downloads are FREE. Search and download functionalities are using the official Maven repository.

uk.co.autotrader.traverson.conversion.ResourceConverter Maven / Gradle / Ivy

Go to download

The kernel of traverson4j. This provides the main API for a client to traverse a Hypermedia REST service

The newest version!
package uk.co.autotrader.traverson.conversion;

import uk.co.autotrader.traverson.exception.ConversionException;

import java.io.InputStream;

/**
 * 

Register instances via META-INF/services/uk.co.autotrader.traverson.conversion.ResourceConverter Service loader config

*

Or register them via ResourceConversionService.addConverter()

*

Classes implementing this should be thread safe

* @param return type */ public interface ResourceConverter { /** * @return Destination Class that this converter will support */ Class getDestinationType(); /** * Should only ever throw {@link uk.co.autotrader.traverson.exception.ConversionException} * * @param resource An InputStream of the resource wanting to be converted. This class should close the inputStream, unless explicitly documented * @param returnType the class for the returned object * @throws ConversionException if the conversion fails * @return instance of returnType */ T convert(InputStream resource, Class returnType); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy