public CtField[] getDeclaredFields() {
        CtMember.Cache memCache = getMembers();
        CtMember field = memCache.fieldHead();
        CtMember tail = memCache.lastField();
        int num = CtMember.Cache.count(field, tail);
        CtField[] cfs = new CtField[num];
        int i = 0;
        while (field != tail) {
            field = field.next();
            cfs[i++] = (CtField)field;
        }

        return cfs;
    }