• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

box / box-java-sdk / #4040

17 Oct 2024 12:51PM CUT coverage: 71.745% (-0.002%) from 71.747%
#4040

push

github

web-flow
chore: release 4.12.0 (#1267)

8039 of 11205 relevant lines covered (71.74%)

0.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/com/box/sdk/BoxFileUploadSessionPartList.java
1
package com.box.sdk;
2

3
import com.eclipsesource.json.JsonArray;
4
import com.eclipsesource.json.JsonObject;
5
import com.eclipsesource.json.JsonValue;
6
import java.util.ArrayList;
7
import java.util.List;
8

9
/**
10
 * Contains the list of parts of a large file that are already uploaded.
11
 * It also contains a offset to represent the paging.
12
 */
13
public class BoxFileUploadSessionPartList extends BoxJSONObject {
14

15
    private List<BoxFileUploadSessionPart> entries;
16
    private int offset;
17
    private int limit;
18
    private int totalCount;
19

20
    /**
21
     * Constructs an BoxFileUploadSessionPart object using an already parsed JSON object.
22
     *
23
     * @param jsonObject the parsed JSON object.
24
     */
25
    BoxFileUploadSessionPartList(JsonObject jsonObject) {
26
        super(jsonObject);
×
27
    }
×
28

29
    /**
30
     * Returns the list of parts that are already uploaded.
31
     *
32
     * @return the list of parts.
33
     */
34
    public List<BoxFileUploadSessionPart> getEntries() {
35
        return this.entries;
×
36
    }
37

38
    /**
39
     * Returns the paging offset for the list of parts.
40
     *
41
     * @return the paging offset.
42
     */
43
    public int getOffset() {
44
        return this.offset;
×
45
    }
46

47
    /**
48
     * Returns the limit on number of entires in a response.
49
     *
50
     * @return the limit
51
     */
52
    public int getLimit() {
53
        return this.limit;
×
54
    }
55

56
    /**
57
     * Returns the total count of entries.
58
     *
59
     * @return the toal count of entries
60
     */
61
    public int getTotalCount() {
62
        return this.totalCount;
×
63
    }
64

65
    @Override
66
    protected void parseJSONMember(JsonObject.Member member) {
67
        String memberName = member.getName();
×
68
        JsonValue value = member.getValue();
×
69
        if (memberName.equals("entries")) {
×
70
            JsonArray array = (JsonArray) value;
×
71

72
            if (array.size() > 0) {
×
73
                this.entries = this.getParts(array);
×
74
            }
75
        } else if (memberName.equals("offset")) {
×
76
            this.offset = Double.valueOf(value.toString()).intValue();
×
77
        } else if (memberName.equals("limit")) {
×
78
            this.limit = Double.valueOf(value.toString()).intValue();
×
79
        } else if (memberName.equals("total_count")) {
×
80
            this.totalCount = Double.valueOf(value.toString()).intValue();
×
81
        }
82
    }
×
83

84
    /*
85
     * Creates List of parts from the JSON array
86
     */
87
    private List<BoxFileUploadSessionPart> getParts(JsonArray partsArray) {
88
        List<BoxFileUploadSessionPart> parts = new ArrayList<BoxFileUploadSessionPart>();
×
89
        for (JsonValue value : partsArray) {
×
90
            BoxFileUploadSessionPart part = new BoxFileUploadSessionPart((JsonObject) value);
×
91
            parts.add(part);
×
92
        }
×
93
        return parts;
×
94
    }
95
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc