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)
| 960 | */ |
| 961 | |
| 962 | public Object first(InstanceScope scope, Object v) { |
| 963 | if ( v==null ) return null; |
| 964 | Object r = v; |
| 965 | v = convertAnythingIteratableToIterator(scope, v); |
| 966 | if ( v instanceof Iterator) { |
| 967 | Iterator<?> it = (Iterator<?>)v; |
| 968 | if ( it.hasNext() ) { |
| 969 | r = it.next(); |
| 970 | } |
| 971 | } |
| 972 | return r; |
| 973 | } |
| 974 | |
| 975 | /** |
| 976 | * Return the last attribute if multi-valued, or the attribute itself if |
no test coverage detected