Coverage Report - org.apache.tapestry.coerce.StringToListConverter
 
Classes in this File Line Coverage Branch Coverage Complexity
StringToListConverter
0%
0/4
N/A
1
 
 1  
 // Copyright Oct 1, 2006 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 package org.apache.tapestry.coerce;
 15  
 
 16  
 import org.apache.tapestry.TapestryUtils;
 17  
 
 18  
 import java.util.Arrays;
 19  
 import java.util.Collection;
 20  
 
 21  
 
 22  
 /**
 23  
  * Converts String values into {@link Collection} instances. String values can 
 24  
  * be a single "string" or multiple strings delimited by a "," comma.
 25  
  */
 26  0
 public final class StringToListConverter implements TypeConverter
 27  
 {
 28  
     /** 
 29  
      * {@inheritDoc}
 30  
      */
 31  
     public Object convertValue(Object value)
 32  
     {
 33  0
         String input = (String)value;
 34  
         
 35  0
         String[] values = TapestryUtils.split(input);
 36  
         
 37  0
         return Arrays.asList(values);
 38  
     }
 39  
 
 40  
 }