1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.support.types;
14
15 import java.util.ArrayList;
16 import java.util.Arrays;
17 import java.util.Collection;
18
19 import org.apache.xmlbeans.XmlException;
20
21 import com.eviware.soapui.config.StringListConfig;
22
23 public class StringList extends ArrayList<String>
24 {
25 public StringList()
26 {
27 super();
28 }
29
30 public StringList(Collection<? extends String> c)
31 {
32 super(c);
33 }
34
35 public StringList(int initialCapacity)
36 {
37 super(initialCapacity);
38 }
39
40 public StringList( String[] strings )
41 {
42 super( Arrays.asList( strings ));
43 }
44
45 public StringList( Object[] objects )
46 {
47 super();
48
49 for( Object object : objects )
50 add( object == null ? null : object.toString() );
51 }
52
53 public void addAll(String[] strings)
54 {
55 addAll( Arrays.asList( strings ));
56 }
57
58 public String[] toStringArray()
59 {
60 return toArray( new String[size()]);
61 }
62
63 public static StringList fromXml( String value ) throws XmlException
64 {
65 return new StringList( StringListConfig.Factory.parse( value ).getEntryList() );
66 }
67
68 public String toXml()
69 {
70 StringListConfig config = StringListConfig.Factory.newInstance();
71 config.setEntryArray( toStringArray() );
72 return config.xmlText();
73 }
74 }