01: package org.bouncycastle.x509;
02:
03: import java.util.ArrayList;
04: import java.util.Collection;
05:
06: /**
07: * This class contains a collection for collection based <code>X509Store</code>s.
08: *
09: * @see org.bouncycastle.x509.X509Store
10: *
11: */
12: public class X509CollectionStoreParameters implements
13: X509StoreParameters {
14: private Collection collection;
15:
16: /**
17: * Constructor.
18: * <p>
19: * The collection is copied.
20: * </p>
21: *
22: * @param collection
23: * The collection containing X.509 object types.
24: * @throws NullPointerException if <code>collection</code> is <code>null</code>.
25: */
26: public X509CollectionStoreParameters(Collection collection) {
27: if (collection == null) {
28: throw new NullPointerException("collection cannot be null");
29: }
30: this .collection = collection;
31: }
32:
33: /**
34: * Returns a shallow clone. The returned contents are not copied, so adding
35: * or removing objects will effect this.
36: *
37: * @return a shallow clone.
38: */
39: public Object clone() {
40: return new X509CollectionStoreParameters(collection);
41: }
42:
43: /**
44: * Returns a copy of the <code>Collection</code>.
45: *
46: * @return The <code>Collection</code>. Is never <code>null</code>.
47: */
48: public Collection getCollection() {
49: return new ArrayList(collection);
50: }
51:
52: /**
53: * Returns a formatted string describing the parameters.
54: *
55: * @return a formatted string describing the parameters
56: */
57: public String toString() {
58: StringBuffer sb = new StringBuffer();
59: sb.append("X509CollectionStoreParameters: [\n");
60: sb.append(" collection: " + collection + "\n");
61: sb.append("]");
62: return sb.toString();
63: }
64: }
|