colesico.framework.telehttp.OriginTeleReader Maven / Gradle / Ivy
package colesico.framework.telehttp;
/**
* Basic origin based reader
*
* @param type of value to be read
* @param reading context
*/
abstract public class OriginTeleReader implements HttpTeleReader {
protected final OriginFactory originFactory;
public OriginTeleReader(OriginFactory originFactory) {
this.originFactory = originFactory;
}
/**
* Return param string value from origin defined in the context
*/
protected final String readString(C context) {
Origin origin = originFactory.getOrigin(context.getOriginName());
return origin.getString(context.getParamName());
}
protected final String readString(String originName, String paramName) {
Origin origin = originFactory.getOrigin(originName);
return origin.getString(paramName);
}
}