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

org.webpieces.webserver.impl.ConverterLookupProxy Maven / Gradle / Ivy

There is a newer version: 2.1.1
Show newest version
package org.webpieces.webserver.impl;

import javax.inject.Inject;

import org.webpieces.router.api.RouterService;
import org.webpieces.router.api.extensions.ObjectStringConverter;
import org.webpieces.templating.api.ConverterLookup;

public class ConverterLookupProxy implements ConverterLookup {

	private RouterService router;

	@Inject
	public ConverterLookupProxy(RouterService router) {
		this.router = router;
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public String convert(Object value) {
		if(value == null)
			return null;

		@SuppressWarnings("rawtypes")
		ObjectStringConverter converter = router.getConverterFor(value);
		return converter.objectToString(value);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy