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

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

本文整理了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

  1. @Override
  2. TemplateModel _eval(Environment env) throws TemplateException {
  3. TemplateModel tm;
  4. if (exp instanceof ParentheticalExpression) {
  5. boolean lastFIRE = env.setFastInvalidReferenceExceptions(true);
  6. try {
  7. tm = exp.eval(env);
  8. } catch (InvalidReferenceException ire) {
  9. tm = null;
  10. } finally {
  11. env.setFastInvalidReferenceExceptions(lastFIRE);
  12. }
  13. } else {
  14. tm = exp.eval(env);
  15. }
  16. return tm == null ? TemplateBooleanModel.FALSE : TemplateBooleanModel.TRUE;
  17. }

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

  1. protected TemplateModel evalMaybeNonexistentTarget(Environment env) throws TemplateException {
  2. TemplateModel tm;
  3. if (target instanceof ParentheticalExpression) {
  4. boolean lastFIRE = env.setFastInvalidReferenceExceptions(true);
  5. try {
  6. tm = target.eval(env);
  7. } catch (InvalidReferenceException ire) {
  8. tm = null;
  9. } finally {
  10. env.setFastInvalidReferenceExceptions(lastFIRE);
  11. }
  12. } else {
  13. tm = target.eval(env);
  14. }
  15. return tm;
  16. }

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

  1. @Override
  2. TemplateModel _eval(Environment env) throws TemplateException {
  3. TemplateModel left;
  4. if (lho instanceof ParentheticalExpression) {
  5. boolean lastFIRE = env.setFastInvalidReferenceExceptions(true);
  6. try {
  7. left = lho.eval(env);
  8. } catch (InvalidReferenceException ire) {
  9. left = null;
  10. } finally {
  11. env.setFastInvalidReferenceExceptions(lastFIRE);
  12. }
  13. } else {
  14. left = lho.eval(env);
  15. }
  16. if (left != null) return left;
  17. else if (rho == null) return EMPTY_STRING_AND_SEQUENCE_AND_HASH;
  18. else return rho.eval(env);
  19. }

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

  1. this.out = sw;
  2. TemplateException thrownException = null;
  3. boolean lastFIRE = setFastInvalidReferenceExceptions(false);
  4. boolean lastInAttemptBlock = inAttemptBlock;
  5. try {
  6. } finally {
  7. inAttemptBlock = lastInAttemptBlock;
  8. setFastInvalidReferenceExceptions(lastFIRE);
  9. this.out = prevOut;

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

  1. public Writer getWriter(final Writer out, Map args) throws TemplateModelException, IOException {
  2. try {
  3. Environment env = Environment.getCurrentEnvironment();
  4. boolean lastFIRE = env.setFastInvalidReferenceExceptions(false);
  5. try {
  6. env.include(template);
  7. } finally {
  8. env.setFastInvalidReferenceExceptions(lastFIRE);

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

  1. @Override
  2. TemplateModel _eval(Environment env) throws TemplateException {
  3. TemplateModel tm;
  4. if (exp instanceof ParentheticalExpression) {
  5. boolean lastFIRE = env.setFastInvalidReferenceExceptions(true);
  6. try {
  7. tm = exp.eval(env);
  8. } catch (InvalidReferenceException ire) {
  9. tm = null;
  10. } finally {
  11. env.setFastInvalidReferenceExceptions(lastFIRE);
  12. }
  13. } else {
  14. tm = exp.eval(env);
  15. }
  16. return tm == null ? TemplateBooleanModel.FALSE : TemplateBooleanModel.TRUE;
  17. }

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

  1. protected TemplateModel evalMaybeNonexistentTarget(Environment env) throws TemplateException {
  2. TemplateModel tm;
  3. if (target instanceof ParentheticalExpression) {
  4. boolean lastFIRE = env.setFastInvalidReferenceExceptions(true);
  5. try {
  6. tm = target.eval(env);
  7. } catch (InvalidReferenceException ire) {
  8. tm = null;
  9. } finally {
  10. env.setFastInvalidReferenceExceptions(lastFIRE);
  11. }
  12. } else {
  13. tm = target.eval(env);
  14. }
  15. return tm;
  16. }

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

  1. protected TemplateModel evalMaybeNonexistentTarget(Environment env) throws TemplateException {
  2. TemplateModel tm;
  3. if (target instanceof ParentheticalExpression) {
  4. boolean lastFIRE = env.setFastInvalidReferenceExceptions(true);
  5. try {
  6. tm = target.eval(env);
  7. } catch (InvalidReferenceException ire) {
  8. tm = null;
  9. } finally {
  10. env.setFastInvalidReferenceExceptions(lastFIRE);
  11. }
  12. } else {
  13. tm = target.eval(env);
  14. }
  15. return tm;
  16. }

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

  1. @Override
  2. TemplateModel _eval(Environment env) throws TemplateException {
  3. TemplateModel tm;
  4. if (exp instanceof ParentheticalExpression) {
  5. boolean lastFIRE = env.setFastInvalidReferenceExceptions(true);
  6. try {
  7. tm = exp.eval(env);
  8. } catch (InvalidReferenceException ire) {
  9. tm = null;
  10. } finally {
  11. env.setFastInvalidReferenceExceptions(lastFIRE);
  12. }
  13. } else {
  14. tm = exp.eval(env);
  15. }
  16. return tm == null ? TemplateBooleanModel.FALSE : TemplateBooleanModel.TRUE;
  17. }

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

  1. @Override
  2. TemplateModel _eval(Environment env) throws TemplateException {
  3. TemplateModel left;
  4. if (lho instanceof ParentheticalExpression) {
  5. boolean lastFIRE = env.setFastInvalidReferenceExceptions(true);
  6. try {
  7. left = lho.eval(env);
  8. } catch (InvalidReferenceException ire) {
  9. left = null;
  10. } finally {
  11. env.setFastInvalidReferenceExceptions(lastFIRE);
  12. }
  13. } else {
  14. left = lho.eval(env);
  15. }
  16. if (left != null) return left;
  17. else if (rho == null) return EMPTY_STRING_AND_SEQUENCE_AND_HASH;
  18. else return rho.eval(env);
  19. }

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

  1. @Override
  2. TemplateModel _eval(Environment env) throws TemplateException {
  3. TemplateModel left;
  4. if (lho instanceof ParentheticalExpression) {
  5. boolean lastFIRE = env.setFastInvalidReferenceExceptions(true);
  6. try {
  7. left = lho.eval(env);
  8. } catch (InvalidReferenceException ire) {
  9. left = null;
  10. } finally {
  11. env.setFastInvalidReferenceExceptions(lastFIRE);
  12. }
  13. } else {
  14. left = lho.eval(env);
  15. }
  16. if (left != null) return left;
  17. else if (rho == null) return EMPTY_STRING_AND_SEQUENCE_AND_HASH;
  18. else return rho.eval(env);
  19. }

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

  1. this.out = sw;
  2. TemplateException thrownException = null;
  3. boolean lastFIRE = setFastInvalidReferenceExceptions(false);
  4. boolean lastInAttemptBlock = inAttemptBlock;
  5. try {
  6. } finally {
  7. inAttemptBlock = lastInAttemptBlock;
  8. setFastInvalidReferenceExceptions(lastFIRE);
  9. this.out = prevOut;

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

  1. this.out = sw;
  2. TemplateException thrownException = null;
  3. boolean lastFIRE = setFastInvalidReferenceExceptions(false);
  4. boolean lastInAttemptBlock = inAttemptBlock;
  5. try {
  6. } finally {
  7. inAttemptBlock = lastInAttemptBlock;
  8. setFastInvalidReferenceExceptions(lastFIRE);
  9. this.out = prevOut;

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

  1. public Writer getWriter(final Writer out, Map args) throws TemplateModelException, IOException {
  2. try {
  3. Environment env = Environment.getCurrentEnvironment();
  4. boolean lastFIRE = env.setFastInvalidReferenceExceptions(false);
  5. try {
  6. env.include(template);
  7. } finally {
  8. env.setFastInvalidReferenceExceptions(lastFIRE);

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

  1. public Writer getWriter(final Writer out, Map args) throws TemplateModelException, IOException {
  2. try {
  3. Environment env = Environment.getCurrentEnvironment();
  4. boolean lastFIRE = env.setFastInvalidReferenceExceptions(false);
  5. try {
  6. env.include(template);
  7. } finally {
  8. env.setFastInvalidReferenceExceptions(lastFIRE);

相关文章

Environment类方法