View Javadoc

1   /*
2    *  soapUI, copyright (C) 2006 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of the GNU Lesser General Public License as published by the Free Software Foundation; 
6    *  either version 2.1 of the License, or (at your option) any later version.
7    *
8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
10   *  See the GNU Lesser General Public License for more details at gnu.org.
11   */
12  
13  package com.eviware.soapui.model.support;
14  
15  import java.util.List;
16  
17  import com.eviware.soapui.model.ModelItem;
18  
19  /***
20   * Utility methods for soapui model-related interfaces
21   *  
22   * @author Ole.Matzura
23   */
24  
25  public class ModelSupport
26  {
27  	public static String[] getNames(List<? extends ModelItem> list)
28  	{
29  		String [] names = new String[list.size()];
30  		for( int c = 0; c < names.length; c++ )
31  		{
32  			names[c] = list.get( c ).getName();
33  		}
34  		
35  		return names;
36  	}
37  	
38  	public static String[] getNames( String [] firstItems, List<? extends ModelItem> list)
39  	{
40  		String [] names = new String[list.size()+firstItems.length];
41  		for( int c = 0; c < firstItems.length; c++ )
42  		{
43  			names[c] = firstItems[c];
44  		}
45  		
46  		for( int c = 0; c < list.size(); c++ )
47  		{
48  			names[c+firstItems.length] = list.get( c ).getName();
49  		}
50  		
51  		return names;
52  	}
53  
54  	public static String[] getNames( List<? extends ModelItem> list, String [] lastItems)
55  	{
56  		String [] names = new String[list.size()+lastItems.length];
57  		for( int c = 0; c < lastItems.length; c++ )
58  		{
59  			names[c+list.size()] = lastItems[c];
60  		}
61  		
62  		for( int c = 0; c < list.size(); c++ )
63  		{
64  			names[c] = list.get( c ).getName();
65  		}
66  		
67  		return names;
68  	}
69  
70  }