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

box / box-java-sdk / #5187

15 Oct 2025 09:59AM UTC coverage: 13.665%. Remained the same
#5187

push

github

web-flow
fix(boxsdkgen): Use `FolderFull` in `Item` (box/box-codegen#860) (#1501)

0 of 7 new or added lines in 1 file covered. (0.0%)

1 existing line in 1 file now uncovered.

8374 of 61282 relevant lines covered (13.66%)

0.14 hits per line

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

0.0
/src/main/java/com/box/sdkgen/schemas/item/Item.java
1
package com.box.sdkgen.schemas.item;
2

3
import com.box.sdkgen.internal.OneOfThree;
4
import com.box.sdkgen.schemas.filefull.FileFull;
5
import com.box.sdkgen.schemas.folderfull.FolderFull;
6
import com.box.sdkgen.schemas.weblink.WebLink;
7
import com.box.sdkgen.serialization.json.EnumWrapper;
8
import com.box.sdkgen.serialization.json.JsonManager;
9
import com.fasterxml.jackson.core.JsonParser;
10
import com.fasterxml.jackson.databind.DeserializationContext;
11
import com.fasterxml.jackson.databind.JsonDeserializer;
12
import com.fasterxml.jackson.databind.JsonMappingException;
13
import com.fasterxml.jackson.databind.JsonNode;
14
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
15
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
16
import java.io.IOException;
17

18
@JsonDeserialize(using = Item.ItemDeserializer.class)
19
@JsonSerialize(using = OneOfThree.OneOfThreeSerializer.class)
20
public class Item extends OneOfThree<FileFull, FolderFull, WebLink> {
21

22
  protected final String sequenceId;
23

24
  protected final String name;
25

26
  protected final String id;
27

28
  protected final String etag;
29

30
  protected final String type;
31

32
  public Item(FileFull fileFull) {
33
    super(fileFull, null, null);
×
34
    this.sequenceId = fileFull.getSequenceId();
×
35
    this.name = fileFull.getName();
×
36
    this.id = fileFull.getId();
×
37
    this.etag = fileFull.getEtag();
×
38
    this.type = EnumWrapper.convertToString(fileFull.getType());
×
39
  }
×
40

41
  public Item(FolderFull folderFull) {
NEW
42
    super(null, folderFull, null);
×
NEW
43
    this.sequenceId = folderFull.getSequenceId();
×
NEW
44
    this.name = folderFull.getName();
×
NEW
45
    this.id = folderFull.getId();
×
NEW
46
    this.etag = folderFull.getEtag();
×
NEW
47
    this.type = EnumWrapper.convertToString(folderFull.getType());
×
UNCOV
48
  }
×
49

50
  public Item(WebLink webLink) {
51
    super(null, null, webLink);
×
52
    this.sequenceId = webLink.getSequenceId();
×
53
    this.name = webLink.getName();
×
54
    this.id = webLink.getId();
×
55
    this.etag = webLink.getEtag();
×
56
    this.type = EnumWrapper.convertToString(webLink.getType());
×
57
  }
×
58

59
  public boolean isFileFull() {
60
    return value0 != null;
×
61
  }
62

63
  public FileFull getFileFull() {
64
    return value0;
×
65
  }
66

67
  public boolean isFolderFull() {
68
    return value1 != null;
×
69
  }
70

71
  public FolderFull getFolderFull() {
72
    return value1;
×
73
  }
74

75
  public boolean isWebLink() {
76
    return value2 != null;
×
77
  }
78

79
  public WebLink getWebLink() {
80
    return value2;
×
81
  }
82

83
  public String getSequenceId() {
84
    return sequenceId;
×
85
  }
86

87
  public String getName() {
88
    return name;
×
89
  }
90

91
  public String getId() {
92
    return id;
×
93
  }
94

95
  public String getEtag() {
96
    return etag;
×
97
  }
98

99
  public String getType() {
100
    return type;
×
101
  }
102

103
  static class ItemDeserializer extends JsonDeserializer<Item> {
104

105
    public ItemDeserializer() {
106
      super();
×
107
    }
×
108

109
    @Override
110
    public Item deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
111
      JsonNode node = JsonManager.jsonToSerializedData(jp);
×
112
      JsonNode discriminant0 = node.get("type");
×
113
      if (!(discriminant0 == null)) {
×
114
        switch (discriminant0.asText()) {
×
115
          case "file":
116
            return new Item(JsonManager.deserialize(node, FileFull.class));
×
117
          case "folder":
NEW
118
            return new Item(JsonManager.deserialize(node, FolderFull.class));
×
119
          case "web_link":
120
            return new Item(JsonManager.deserialize(node, WebLink.class));
×
121
        }
122
      }
123
      throw new JsonMappingException(jp, "Unable to deserialize Item");
×
124
    }
125
  }
126
}
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

© 2026 Coveralls, Inc