if( collection instanceof ElementList )
{
final ElementList<?> list = (ElementList<?>) collection;
final ListProperty listProperty = list.definition();
final ElementType listEntryType = listProperty.getType();
final ValueProperty listEntryProperty;
if( operands().size() > 1 )
{
final String listEntryPropertyName = cast( operand( 1 ), String.class );
final PropertyDef prop = listEntryType.property( listEntryPropertyName );
if( prop == null )
{
throw new FunctionException( missingProperty.format( listEntryType.getSimpleName(), listEntryPropertyName ) );
}
if( ! ( prop instanceof ValueProperty ) )
{
throw new FunctionException( notValueProperty.format( listEntryType.getSimpleName(), listEntryPropertyName ) );
}
listEntryProperty = (ValueProperty) prop;
}
else
{
ValueProperty prop = null;
for( PropertyDef p : listEntryType.properties() )
{
if( p instanceof ValueProperty )
{