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

box / box-java-sdk-gen / #358

11 Jul 2025 04:43PM UTC coverage: 38.091% (+2.5%) from 35.58%
#358

Pull #361

github

web-flow
Merge 112b63b24 into 426763c84
Pull Request #361: feat: Support common fields in Union in Java (box/box-codegen#758)

288 of 1203 new or added lines in 106 files covered. (23.94%)

167 existing lines in 45 files now uncovered.

18543 of 48681 relevant lines covered (38.09%)

0.38 hits per line

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

8.7
/src/main/java/com/box/sdkgen/schemas/aiagentallowedentity/AiAgentAllowedEntity.java
1
package com.box.sdkgen.schemas.aiagentallowedentity;
2

3
import com.box.sdkgen.internal.OneOfTwo;
4
import com.box.sdkgen.schemas.groupbase.GroupBase;
5
import com.box.sdkgen.schemas.userbase.UserBase;
6
import com.box.sdkgen.serialization.json.EnumWrapper;
7
import com.box.sdkgen.serialization.json.JsonManager;
8
import com.fasterxml.jackson.core.JsonParser;
9
import com.fasterxml.jackson.databind.DeserializationContext;
10
import com.fasterxml.jackson.databind.JsonDeserializer;
11
import com.fasterxml.jackson.databind.JsonMappingException;
12
import com.fasterxml.jackson.databind.JsonNode;
13
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
14
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
15
import java.io.IOException;
16

17
@JsonDeserialize(using = AiAgentAllowedEntity.AiAgentAllowedEntityDeserializer.class)
18
@JsonSerialize(using = OneOfTwo.OneOfTwoSerializer.class)
19
public class AiAgentAllowedEntity extends OneOfTwo<UserBase, GroupBase> {
20

21
  protected final String id;
22

23
  protected final String type;
24

25
  public AiAgentAllowedEntity(UserBase userBase) {
26
    super(userBase, null);
×
NEW
27
    this.id = userBase.getId();
×
NEW
28
    this.type = EnumWrapper.convertToString(userBase.getType());
×
UNCOV
29
  }
×
30

31
  public AiAgentAllowedEntity(GroupBase groupBase) {
32
    super(null, groupBase);
×
NEW
33
    this.id = groupBase.getId();
×
NEW
34
    this.type = EnumWrapper.convertToString(groupBase.getType());
×
NEW
35
  }
×
36

37
  public boolean isUserBase() {
NEW
38
    return value0 != null;
×
39
  }
40

41
  public UserBase getUserBase() {
42
    return value0;
×
43
  }
44

45
  public boolean isGroupBase() {
NEW
46
    return value1 != null;
×
47
  }
48

49
  public GroupBase getGroupBase() {
50
    return value1;
×
51
  }
52

53
  public String getId() {
NEW
54
    return id;
×
55
  }
56

57
  public String getType() {
NEW
58
    return type;
×
59
  }
60

61
  static class AiAgentAllowedEntityDeserializer extends JsonDeserializer<AiAgentAllowedEntity> {
62

63
    public AiAgentAllowedEntityDeserializer() {
64
      super();
1✔
65
    }
1✔
66

67
    @Override
68
    public AiAgentAllowedEntity deserialize(JsonParser jp, DeserializationContext ctxt)
69
        throws IOException {
70
      JsonNode node = JsonManager.jsonToSerializedData(jp);
×
71
      JsonNode discriminant0 = node.get("type");
×
72
      if (!(discriminant0 == null)) {
×
73
        switch (discriminant0.asText()) {
×
74
          case "user":
75
            return new AiAgentAllowedEntity(JsonManager.deserialize(node, UserBase.class));
×
76
          case "group":
77
            return new AiAgentAllowedEntity(JsonManager.deserialize(node, GroupBase.class));
×
78
        }
79
      }
80
      throw new JsonMappingException(jp, "Unable to deserialize AiAgentAllowedEntity");
×
81
    }
82
  }
83
}
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