Projekt

Obecné

Profil

Stáhnout (1.29 KB) Statistiky
| Větev: | Tag: | Revize:
1
package jdeserialize;
2
import java.io.*;
3
import java.util.*;
4

    
5
/**
6
 * <p>Typed collection used for storing the values of a serialized array.  </p>
7
 *
8
 * <p>Primitive types are stored using their corresponding objects; for instance, an int is
9
 * stored as an Integer.  To determine whether or not this is an array of ints or of
10
 * Integer instances, check the name in the arrayobj's class description.</p>
11
 */
12
public class arraycoll extends ArrayList<Object> {
13
    public static final long serialVersionUID = 2277356908919248L;
14

    
15
    private fieldtype ftype;
16

    
17
    /**
18
     * Constructor.
19
     * @param ft field type of the array
20
     */
21
    public arraycoll(fieldtype ft) {
22
        super();
23
        this.ftype = ft;
24
    }
25

    
26
    /**
27
     * Gets the field type of the array.
28
     *
29
     * @return the field type of the array
30
     */
31
    public fieldtype getFieldType() {
32
        return ftype;
33
    }
34
    public String toString() {
35
        StringBuffer sb = new StringBuffer();
36
        sb.append("[arraycoll sz ").append(this.size());
37
        boolean first = true;
38
        for(Object o: this) {
39
            if(first) {
40
                first = false;
41
                sb.append(' ');
42
            } else {
43
                sb.append(", ");
44
            }
45
            sb.append(o.toString());
46
        }
47
        return sb.toString();
48
    }
49
}
(5-5/20)