freemarker.core.Environment.setFastInvalidReferenceExceptions()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中freemarker.core.Environment.setFastInvalidReferenceExceptions()方法的一些代码示例,展示了Environment.setFastInvalidReferenceExceptions()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.setFastInvalidReferenceExceptions()方法的具体详情如下:
包路径:freemarker.core.Environment
类名称:Environment
方法名:setFastInvalidReferenceExceptions

Environment.setFastInvalidReferenceExceptions介绍

[英]Sets if for invalid references InvalidReferenceException#FAST_INSTANCE should be thrown, or a new InvalidReferenceException. The "fast" instance is used if we know that the error will be handled so that its message will not be logged or shown anywhere.
[中]设置是否应为无效引用引发InvalidReferenceException#FAST#实例,或新的InvalidReferenceException。如果我们知道错误将被处理,从而使其消息不会被记录或显示在任何地方,则使用“fast”实例。

代码示例

代码示例来源:origin: org.freemarker/freemarker

@Override
TemplateModel _eval(Environment env) throws TemplateException {
  TemplateModel tm;
  if (exp instanceof ParentheticalExpression) {
    boolean lastFIRE = env.setFastInvalidReferenceExceptions(true);
    try {
      tm = exp.eval(env);
    } catch (InvalidReferenceException ire) {
      tm = null;
    } finally {
      env.setFastInvalidReferenceExceptions(lastFIRE);
    }
  } else {
    tm = exp.eval(env);
  }
  return tm == null ? TemplateBooleanModel.FALSE : TemplateBooleanModel.TRUE;
}

代码示例来源:origin: org.freemarker/freemarker

protected TemplateModel evalMaybeNonexistentTarget(Environment env) throws TemplateException {
  TemplateModel tm;
  if (target instanceof ParentheticalExpression) {
    boolean lastFIRE = env.setFastInvalidReferenceExceptions(true);
    try {
      tm = target.eval(env);
    } catch (InvalidReferenceException ire) {
      tm = null;
    } finally {
      env.setFastInvalidReferenceExceptions(lastFIRE);
    }
  } else {
    tm = target.eval(env);
  }
  return tm;
}

代码示例来源:origin: org.freemarker/freemarker

@Override
TemplateModel _eval(Environment env) throws TemplateException {
  TemplateModel left;
  if (lho instanceof ParentheticalExpression) {
    boolean lastFIRE = env.setFastInvalidReferenceExceptions(true);
    try {
      left = lho.eval(env);
    } catch (InvalidReferenceException ire) {
      left = null;
    } finally {
      env.setFastInvalidReferenceExceptions(lastFIRE);
    }
  } else {
    left = lho.eval(env);
  }
  
  if (left != null) return left;
  else if (rho == null) return EMPTY_STRING_AND_SEQUENCE_AND_HASH;
  else return rho.eval(env);
}

代码示例来源:origin: org.freemarker/freemarker

this.out = sw;
TemplateException thrownException = null;
boolean lastFIRE = setFastInvalidReferenceExceptions(false);
boolean lastInAttemptBlock = inAttemptBlock;
try {
} finally {
  inAttemptBlock = lastInAttemptBlock;
  setFastInvalidReferenceExceptions(lastFIRE);
  this.out = prevOut;

代码示例来源:origin: org.freemarker/freemarker

public Writer getWriter(final Writer out, Map args) throws TemplateModelException, IOException {
  try {
    Environment env = Environment.getCurrentEnvironment();
    boolean lastFIRE = env.setFastInvalidReferenceExceptions(false);
    try {
      env.include(template);
    } finally {
      env.setFastInvalidReferenceExceptions(lastFIRE);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

@Override
TemplateModel _eval(Environment env) throws TemplateException {
  TemplateModel tm;
  if (exp instanceof ParentheticalExpression) {
    boolean lastFIRE = env.setFastInvalidReferenceExceptions(true);
    try {
      tm = exp.eval(env);
    } catch (InvalidReferenceException ire) {
      tm = null;
    } finally {
      env.setFastInvalidReferenceExceptions(lastFIRE);
    }
  } else {
    tm = exp.eval(env);
  }
  return tm == null ? TemplateBooleanModel.FALSE : TemplateBooleanModel.TRUE;
}

代码示例来源:origin: org.freemarker/freemarker-gae

protected TemplateModel evalMaybeNonexistentTarget(Environment env) throws TemplateException {
  TemplateModel tm;
  if (target instanceof ParentheticalExpression) {
    boolean lastFIRE = env.setFastInvalidReferenceExceptions(true);
    try {
      tm = target.eval(env);
    } catch (InvalidReferenceException ire) {
      tm = null;
    } finally {
      env.setFastInvalidReferenceExceptions(lastFIRE);
    }
  } else {
    tm = target.eval(env);
  }
  return tm;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

protected TemplateModel evalMaybeNonexistentTarget(Environment env) throws TemplateException {
  TemplateModel tm;
  if (target instanceof ParentheticalExpression) {
    boolean lastFIRE = env.setFastInvalidReferenceExceptions(true);
    try {
      tm = target.eval(env);
    } catch (InvalidReferenceException ire) {
      tm = null;
    } finally {
      env.setFastInvalidReferenceExceptions(lastFIRE);
    }
  } else {
    tm = target.eval(env);
  }
  return tm;
}

代码示例来源:origin: org.freemarker/freemarker-gae

@Override
TemplateModel _eval(Environment env) throws TemplateException {
  TemplateModel tm;
  if (exp instanceof ParentheticalExpression) {
    boolean lastFIRE = env.setFastInvalidReferenceExceptions(true);
    try {
      tm = exp.eval(env);
    } catch (InvalidReferenceException ire) {
      tm = null;
    } finally {
      env.setFastInvalidReferenceExceptions(lastFIRE);
    }
  } else {
    tm = exp.eval(env);
  }
  return tm == null ? TemplateBooleanModel.FALSE : TemplateBooleanModel.TRUE;
}

代码示例来源:origin: org.freemarker/freemarker-gae

@Override
TemplateModel _eval(Environment env) throws TemplateException {
  TemplateModel left;
  if (lho instanceof ParentheticalExpression) {
    boolean lastFIRE = env.setFastInvalidReferenceExceptions(true);
    try {
      left = lho.eval(env);
    } catch (InvalidReferenceException ire) {
      left = null;
    } finally {
      env.setFastInvalidReferenceExceptions(lastFIRE);
    }
  } else {
    left = lho.eval(env);
  }
  
  if (left != null) return left;
  else if (rho == null) return EMPTY_STRING_AND_SEQUENCE_AND_HASH;
  else return rho.eval(env);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

@Override
TemplateModel _eval(Environment env) throws TemplateException {
  TemplateModel left;
  if (lho instanceof ParentheticalExpression) {
    boolean lastFIRE = env.setFastInvalidReferenceExceptions(true);
    try {
      left = lho.eval(env);
    } catch (InvalidReferenceException ire) {
      left = null;
    } finally {
      env.setFastInvalidReferenceExceptions(lastFIRE);
    }
  } else {
    left = lho.eval(env);
  }
  
  if (left != null) return left;
  else if (rho == null) return EMPTY_STRING_AND_SEQUENCE_AND_HASH;
  else return rho.eval(env);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

this.out = sw;
TemplateException thrownException = null;
boolean lastFIRE = setFastInvalidReferenceExceptions(false);
boolean lastInAttemptBlock = inAttemptBlock;
try {
} finally {
  inAttemptBlock = lastInAttemptBlock;
  setFastInvalidReferenceExceptions(lastFIRE);
  this.out = prevOut;

代码示例来源:origin: org.freemarker/freemarker-gae

this.out = sw;
TemplateException thrownException = null;
boolean lastFIRE = setFastInvalidReferenceExceptions(false);
boolean lastInAttemptBlock = inAttemptBlock;
try {
} finally {
  inAttemptBlock = lastInAttemptBlock;
  setFastInvalidReferenceExceptions(lastFIRE);
  this.out = prevOut;

代码示例来源:origin: org.freemarker/freemarker-gae

public Writer getWriter(final Writer out, Map args) throws TemplateModelException, IOException {
  try {
    Environment env = Environment.getCurrentEnvironment();
    boolean lastFIRE = env.setFastInvalidReferenceExceptions(false);
    try {
      env.include(template);
    } finally {
      env.setFastInvalidReferenceExceptions(lastFIRE);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

public Writer getWriter(final Writer out, Map args) throws TemplateModelException, IOException {
  try {
    Environment env = Environment.getCurrentEnvironment();
    boolean lastFIRE = env.setFastInvalidReferenceExceptions(false);
    try {
      env.include(template);
    } finally {
      env.setFastInvalidReferenceExceptions(lastFIRE);

相关文章

微信公众号

最新文章

更多

Environment类方法