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

box / box-java-sdk / #5801

03 Dec 2025 11:45AM UTC coverage: 35.917% (-0.02%) from 35.938%
#5801

push

github

web-flow
docs: modify `can_view_path` description and add confidence scores for structured extract (box/box-openapi#566) (#1601)

2 of 12 new or added lines in 2 files covered. (16.67%)

18 existing lines in 8 files now uncovered.

18473 of 51432 relevant lines covered (35.92%)

0.36 hits per line

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

57.14
/src/main/java/com/box/sdkgen/schemas/eventsourceresource/EventSourceResource.java
1
package com.box.sdkgen.schemas.eventsourceresource;
2

3
import com.box.sdkgen.internal.OneOfSix;
4
import com.box.sdkgen.schemas.appitemeventsource.AppItemEventSource;
5
import com.box.sdkgen.schemas.eventsource.EventSource;
6
import com.box.sdkgen.schemas.file.File;
7
import com.box.sdkgen.schemas.folder.Folder;
8
import com.box.sdkgen.schemas.user.User;
9
import com.box.sdkgen.serialization.json.JsonManager;
10
import com.fasterxml.jackson.core.JsonParser;
11
import com.fasterxml.jackson.databind.DeserializationContext;
12
import com.fasterxml.jackson.databind.JsonDeserializer;
13
import com.fasterxml.jackson.databind.JsonMappingException;
14
import com.fasterxml.jackson.databind.JsonNode;
15
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
16
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
17
import java.io.IOException;
18
import java.util.Map;
19

20
@JsonDeserialize(using = EventSourceResource.EventSourceResourceDeserializer.class)
21
@JsonSerialize(using = OneOfSix.OneOfSixSerializer.class)
22
public class EventSourceResource
23
    extends OneOfSix<User, EventSource, File, Folder, Map<String, Object>, AppItemEventSource> {
24

25
  public EventSourceResource(User user) {
26
    super(user, null, null, null, null, null);
1✔
27
  }
1✔
28

29
  public EventSourceResource(EventSource eventSource) {
30
    super(null, eventSource, null, null, null, null);
1✔
31
  }
1✔
32

33
  public EventSourceResource(File file) {
34
    super(null, null, file, null, null, null);
1✔
35
  }
1✔
36

37
  public EventSourceResource(Folder folder) {
UNCOV
38
    super(null, null, null, folder, null, null);
×
UNCOV
39
  }
×
40

41
  public EventSourceResource(Map<String, Object> map) {
42
    super(null, null, null, null, map, null);
1✔
43
  }
1✔
44

45
  public EventSourceResource(AppItemEventSource appItemEventSource) {
46
    super(null, null, null, null, null, appItemEventSource);
×
47
  }
×
48

49
  public boolean isUser() {
50
    return value0 != null;
×
51
  }
52

53
  public User getUser() {
54
    return value0;
1✔
55
  }
56

57
  public boolean isEventSource() {
58
    return value1 != null;
×
59
  }
60

61
  public EventSource getEventSource() {
62
    return value1;
1✔
63
  }
64

65
  public boolean isFile() {
66
    return value2 != null;
×
67
  }
68

69
  public File getFile() {
70
    return value2;
×
71
  }
72

73
  public boolean isFolder() {
74
    return value3 != null;
×
75
  }
76

77
  public Folder getFolder() {
78
    return value3;
×
79
  }
80

81
  public boolean isMap() {
82
    return value4 != null;
×
83
  }
84

85
  public Map<String, Object> getMap() {
86
    return value4;
×
87
  }
88

89
  public boolean isAppItemEventSource() {
90
    return value5 != null;
×
91
  }
92

93
  public AppItemEventSource getAppItemEventSource() {
94
    return value5;
×
95
  }
96

97
  static class EventSourceResourceDeserializer extends JsonDeserializer<EventSourceResource> {
98

99
    public EventSourceResourceDeserializer() {
100
      super();
1✔
101
    }
1✔
102

103
    @Override
104
    public EventSourceResource deserialize(JsonParser jp, DeserializationContext ctxt)
105
        throws IOException {
106
      JsonNode node = JsonManager.jsonToSerializedData(jp);
1✔
107
      JsonNode discriminant0 = node.get("type");
1✔
108
      if (!(discriminant0 == null)) {
1✔
109
        switch (discriminant0.asText()) {
1✔
110
          case "user":
111
            return new EventSourceResource(JsonManager.deserialize(node, User.class));
1✔
112
          case "file":
113
            return new EventSourceResource(JsonManager.deserialize(node, File.class));
1✔
114
          case "folder":
UNCOV
115
            return new EventSourceResource(JsonManager.deserialize(node, Folder.class));
×
116
          case "app_item":
117
            return new EventSourceResource(JsonManager.deserialize(node, AppItemEventSource.class));
×
118
        }
119
      }
120
      JsonNode discriminant1 = node.get("item_type");
1✔
121
      if (!(discriminant1 == null)) {
1✔
122
        switch (discriminant1.asText()) {
1✔
123
          case "file":
124
            return new EventSourceResource(JsonManager.deserialize(node, EventSource.class));
1✔
125
          case "folder":
126
            return new EventSourceResource(JsonManager.deserialize(node, EventSource.class));
1✔
127
        }
128
      }
129
      try {
130
        return new EventSourceResource(OneOfSix.OBJECT_MAPPER.convertValue(node, Map.class));
1✔
131
      } catch (Exception ignored) {
×
132
      }
133
      throw new JsonMappingException(jp, "Unable to deserialize EventSourceResource");
×
134
    }
135
  }
136
}
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