Newer
Older
CactusServer / src / main / java / cactusServer / utils / MyParamConverter.java
package cactusServer.utils;

import javax.ws.rs.ext.ParamConverter;

import cactusServer.entities.StageModel;
import net.arnx.jsonic.JSON;

public class MyParamConverter implements ParamConverter<Object> {
	private Class<?> type;
	
	public MyParamConverter(Class<?> type) {
		this.type = type;
	}

	@Override
	public Object fromString(String value) {
		return JSON.decode(value, type);
	}

	@Override
	public String toString(Object obj) {
		return JSON.encode(obj);
	}
}