Return the first attribute if multi-valued, or the attribute itself if single-valued. This method is used for rendering expressions of the form .
(InstanceScope scope, Object v)
| 940 | */ |
| 941 | |
| 942 | public Object first(InstanceScope scope, Object v) { |
| 943 | if ( v==null ) return null; |
| 944 | Object r = v; |
| 945 | v = convertAnythingIteratableToIterator(scope, v); |
| 946 | if ( v instanceof Iterator ) { |
| 947 | Iterator<?> it = (Iterator<?>)v; |
| 948 | if ( it.hasNext() ) { |
| 949 | r = it.next(); |
| 950 | } |
| 951 | } |
| 952 | return r; |
| 953 | } |
| 954 | |
| 955 | /** |
| 956 | * Return the last attribute if multi-valued, or the attribute itself if |
no test coverage detected