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