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

com.zandero.rest.reader.GenericValueReader Maven / Gradle / Ivy

The newest version!
package com.zandero.rest.reader;

import com.zandero.rest.data.ClassFactory;
import com.zandero.rest.exception.ClassFactoryException;

import javax.ws.rs.Consumes;

/**
 *
 */
@Consumes("*/*")
public class GenericValueReader implements ValueReader {

    @Override
    public Object read(String value, Class type) {

        try {
            return ClassFactory.constructType(type, value);
        } catch (ClassFactoryException e) {
            throw new IllegalArgumentException(e.getMessage());
        }
    }
}