001    package org.apache.tapestry.binding;
002    
003    import org.apache.hivemind.Location;
004    import org.apache.tapestry.IBinding;
005    import org.apache.tapestry.IComponent;
006    
007    import java.util.List;
008    
009    /**
010     * Converts string values to String arrays and hands them off to a {@link ClientIdListBinding} instance.
011     */
012    public class ClientIdListBindingFactory extends AbstractBindingFactory {
013    
014        public IBinding createBinding(IComponent root, String bindingDescription, String expression, Location location)
015        {
016            // convert to String array first
017            List ids = (List) getValueConverter().coerceValue(expression, List.class);
018            String[] clientIds = (String[]) ids.toArray(new String[ids.size()]);
019    
020            return new ClientIdListBinding(bindingDescription, getValueConverter(), location, root, clientIds);
021        }
022    }