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)
| 972 | */ |
| 973 | |
| 974 | public Object first(InstanceScope scope, Object v) { |
| 975 | if ( v==null ) return null; |
| 976 | Object r = v; |
| 977 | v = convertAnythingIteratableToIterator(scope, v); |
| 978 | if ( v instanceof Iterator) { |
| 979 | Iterator<?> it = (Iterator<?>)v; |
| 980 | if ( it.hasNext() ) { |
| 981 | r = it.next(); |
| 982 | } |
| 983 | } |
| 984 | return r; |
| 985 | } |
| 986 | |
| 987 | /** |
| 988 | * Return the last attribute if multi-valued, or the attribute itself if |
no test coverage detected