com.hn.translation.AbstractOnlineTranslator Maven / Gradle / Ivy
package com.hn.translation;
import java.util.HashMap;
import java.util.Map;
public abstract class AbstractOnlineTranslator
implements Translator
{
protected Map langMap = new HashMap();
@Override
public final String trans(LANG from, LANG targ, String query)
throws Exception
{
String response = "";
try
{
response = getResponse(from, targ, query);
return parseString(response);
}
catch (Exception e)
{
e.printStackTrace();
}
return response;
}
protected abstract String getResponse(LANG from, LANG targ, String query)
throws Exception;
/**
*
* @param paramString
* @return
*/
protected abstract String parseString(String paramString);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy