Write out an expression result that uses expression options. E.g.,
(STWriter out, InstanceScope scope, Object o, Object[] options)
| 651 | */ |
| 652 | |
| 653 | protected int writeObjectWithOptions(STWriter out, InstanceScope scope, Object o, Object[] options) { |
| 654 | int start = out.index(); // track char we're about to write |
| 655 | // precompute all option values (render all the way to strings) |
| 656 | String[] optionStrings = null; |
| 657 | if ( options!=null ) { |
| 658 | optionStrings = new String[options.length]; |
| 659 | for (int i = 0; i < Compiler.NUM_OPTIONS; i++) { |
| 660 | optionStrings[i] = toString(out, scope, options[i]); |
| 661 | } |
| 662 | } |
| 663 | if ( options!=null && options[Option.ANCHOR.ordinal()] !=null ) { |
| 664 | out.pushAnchorPoint(); |
| 665 | } |
| 666 | |
| 667 | int n = writeObject(out, scope, o, optionStrings); |
| 668 | if ( options!=null && options[Option.ANCHOR.ordinal()] !=null ) { |
| 669 | out.popAnchorPoint(); |
| 670 | } |
| 671 | if ( debug ) { |
| 672 | EvalExprEvent e = new EvalExprEvent(scope, |
| 673 | start, |
| 674 | out.index()-1, |
| 675 | getExprStartChar(scope), |
| 676 | getExprStopChar(scope)); |
| 677 | trackDebugEvent(scope, e); |
| 678 | } |
| 679 | return n; |
| 680 | } |
| 681 | |
| 682 | /** Generic method to emit text for an object. It differentiates |
| 683 | * between templates, iterable objects, and plain old Java objects (POJOs) |
no test coverage detected