本文整理汇总了Java中org.stringtemplate.v4.misc.STMessage类的典型用法代码示例。如果您正苦于以下问题:Java STMessage类的具体用法?Java STMessage怎么用?Java STMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
STMessage类属于org.stringtemplate.v4.misc包,在下文中一共展示了STMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: STViz
import org.stringtemplate.v4.misc.STMessage; //导入依赖的package包/类
public STViz(ErrorManager errMgr,
EvalTemplateEvent root,
String output,
Interpreter interp,
List<String> trace,
List<STMessage> errors)
{
this.errMgr = errMgr;
this.currentEvent = root;
this.currentScope = root.scope;
this.output = output;
this.interp = interp;
this.allEvents = interp.getEvents();
this.trace = trace;
this.errors = errors;
}
示例2: STViz
import org.stringtemplate.v4.misc.STMessage; //导入依赖的package包/类
public STViz(ErrorManager errMgr, EvalTemplateEvent root, String output, Interpreter interp, List<String> trace, List<STMessage> errors) {
this.errMgr = errMgr;
this.currentEvent = root;
this.currentScope = root.scope;
this.output = output;
this.interp = interp;
this.allEvents = interp.getEvents();
this.trace = trace;
this.errors = errors;
}
示例3: report
import org.stringtemplate.v4.misc.STMessage; //导入依赖的package包/类
private void report(String msgType, STMessage msg)
{
// only report the full error with potential stack trace if verbose
if (verboseMode) {
logError(msgType + " " + msg.toString());
} else {
logError(msgType + " " + String.format(msg.error.message, msg.arg, msg.arg2, msg.arg3) );
}
}
示例4: renderContentTemplate
import org.stringtemplate.v4.misc.STMessage; //导入依赖的package包/类
/** Renders template into string
* @return The rendered template if exists, or empty string */
private final String renderContentTemplate(final ST contentTemplate, final Map<String, Object> values/*, final String language*/, final ErrorBuffer error) {
if (contentTemplate != null) { // it has to be possible to use a layout without defining a template
Writer sw = new StringBuilderWriter();
final ErrorBuffer templateErrors = new ErrorBuffer();
renderContentTemplate(contentTemplate, sw, values/*, language*/, templateErrors);
// handle potential errors
if (!templateErrors.errors.isEmpty()) {
for (STMessage err : templateErrors.errors) {
if (err.error == ErrorType.INTERNAL_ERROR) {
log.warn("Reloading GroupDir as we have found a problem during rendering of template \"{}\"\n{}",contentTemplate.getName(), templateErrors.errors.toString());
//README when errors occur, try to reload the specified templates and try the whole thing again
// this often rectifies the problem
reloadGroup();
ST reloadedContentTemplate = readTemplate(contentTemplate.getName());
sw = new StringBuilderWriter();
renderContentTemplate(reloadedContentTemplate, sw, values/*, language*/, error);
break;
}
}
}
return sw.toString();
}
return "";
}
示例5: compileTimeError
import org.stringtemplate.v4.misc.STMessage; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void compileTimeError(@NotNull final STMessage stMessage)
{
@Nullable final Log log = UniqueLogFactory.getLog(AbstractQueryJTemplate.class);
if (log != null)
{
log.error(stMessage.toString());
}
}
示例6: runTimeError
import org.stringtemplate.v4.misc.STMessage; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void runTimeError(@NotNull final STMessage stMessage)
{
@Nullable final Log log = UniqueLogFactory.getLog(AbstractQueryJTemplate.class);
if (log != null)
{
log.error(stMessage.toString());
}
}
示例7: IOError
import org.stringtemplate.v4.misc.STMessage; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void IOError(@NotNull final STMessage stMessage)
{
@Nullable final Log log = UniqueLogFactory.getLog(AbstractQueryJTemplate.class);
if (log != null)
{
log.error(stMessage.toString());
}
}
示例8: internalError
import org.stringtemplate.v4.misc.STMessage; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void internalError(@NotNull final STMessage stMessage)
{
@Nullable final Log log = UniqueLogFactory.getLog(AbstractQueryJTemplate.class);
if (log != null)
{
log.error(stMessage.toString());
}
}
示例9: throwFor
import org.stringtemplate.v4.misc.STMessage; //导入依赖的package包/类
private void throwFor(STMessage msg) {
// Best API in the world, have to format things manually, because only toString() does this for us, but
// toString() will also include the stack trace and the result would be ugly.
String text = String.format(msg.error.message, msg.arg, msg.arg2, msg.arg3);
// We throw Errors, because ST will catch Exceptions and call us again
if (msg.cause != null)
throw new Error(text, msg.cause);
else
throw new Error(text);
}
示例10: userCodeException
import org.stringtemplate.v4.misc.STMessage; //导入依赖的package包/类
public String userCodeException(STMessage arg) {
Throwable t = arg.cause;
if (t instanceof STNoSuchPropertyException) {
STNoSuchPropertyException exp = (STNoSuchPropertyException)t;
if (exp.getCause() != null && exp.getCause() instanceof InvocationTargetException) {
InvocationTargetException ite = (InvocationTargetException)exp.getCause();
return "User Code Exception: " + ite.getCause();
}
}
return "<Unknown>";
}
示例11: compileTimeError
import org.stringtemplate.v4.misc.STMessage; //导入依赖的package包/类
@Override
public void compileTimeError(STMessage msg) {
System.err.println(msg.toString());
}
示例12: internalError
import org.stringtemplate.v4.misc.STMessage; //导入依赖的package包/类
@Override
public void internalError(STMessage msg) {
System.err.println(msg.toString());
}
示例13: IOError
import org.stringtemplate.v4.misc.STMessage; //导入依赖的package包/类
@Override
public void IOError(STMessage msg) {
System.err.println(msg.toString());
}
示例14: runTimeError
import org.stringtemplate.v4.misc.STMessage; //导入依赖的package包/类
@Override
public void runTimeError(STMessage msg) {
System.err.println(msg.toString());
}
示例15: compileTimeError
import org.stringtemplate.v4.misc.STMessage; //导入依赖的package包/类
@Override
public void compileTimeError(STMessage stMessage) {
throw new GeneratorException(stMessage.toString());
}