restx.entity.EntityRequestBodyReaderRegistry Maven / Gradle / Ivy
package restx.entity;
import com.google.common.base.Joiner;
import com.google.common.base.Optional;
import restx.factory.Component;
import java.lang.reflect.Type;
/**
* Date: 23/10/13
* Time: 09:53
*/
@Component
public class EntityRequestBodyReaderRegistry {
private final EntityContentTypeResolver entityContentTypeResolver;
private final Iterable entityRequestBodyReaderFactories;
public EntityRequestBodyReaderRegistry(Iterable entityDefaultContentTypeProviders,
Iterable entityRequestBodyReaderFactories) {
entityContentTypeResolver = new EntityContentTypeResolver(entityDefaultContentTypeProviders);
this.entityRequestBodyReaderFactories = entityRequestBodyReaderFactories;
}
@SuppressWarnings("unchecked")
public EntityRequestBodyReader build(final Type type, Optional contentType) {
String ct = entityContentTypeResolver.resolveContentType(type, contentType);
for (EntityRequestBodyReaderFactory readerFactory : entityRequestBodyReaderFactories) {
Optional extends EntityRequestBodyReader