Renders expressions of the form or .
(InstanceScope scope, Object attr, List<ST> prototypes)
| 785 | */ |
| 786 | |
| 787 | protected void rot_map(InstanceScope scope, Object attr, List<ST> prototypes) { |
| 788 | if ( attr==null ) { |
| 789 | operands[++sp] = null; |
| 790 | return; |
| 791 | } |
| 792 | attr = convertAnythingIteratableToIterator(scope, attr); |
| 793 | if ( attr instanceof Iterator ) { |
| 794 | List<ST> mapped = rot_map_iterator(scope, (Iterator)attr, prototypes); |
| 795 | operands[++sp] = mapped; |
| 796 | } |
| 797 | else { // if only single value, just apply first template to sole value |
| 798 | ST proto = prototypes.get(0); |
| 799 | ST st = group.createStringTemplateInternally(proto); |
| 800 | if ( st!=null ) { |
| 801 | setFirstArgument(scope, st, attr); |
| 802 | if ( st.impl.isAnonSubtemplate ) { |
| 803 | st.rawSetAttribute("i0", 0); |
| 804 | st.rawSetAttribute("i", 1); |
| 805 | } |
| 806 | operands[++sp] = st; |
| 807 | } |
| 808 | else { |
| 809 | operands[++sp] = null; |
| 810 | } |
| 811 | } |
| 812 | } |
| 813 | |
| 814 | protected List<ST> rot_map_iterator(InstanceScope scope, Iterator<?> attr, List<ST> prototypes) { |
| 815 | List<ST> mapped = new ArrayList<ST>(); |
no test coverage detected