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