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

box / box-java-sdk-gen / #356

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

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.

18536 of 48681 relevant lines covered (38.08%)

0.38 hits per line

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

27.27
/src/main/java/com/box/sdkgen/schemas/aiagentaskoraiagentreference/AiAgentAskOrAiAgentReference.java
1
package com.box.sdkgen.schemas.aiagentaskoraiagentreference;
2

3
import com.box.sdkgen.internal.OneOfTwo;
4
import com.box.sdkgen.schemas.aiagentask.AiAgentAsk;
5
import com.box.sdkgen.schemas.aiagentreference.AiAgentReference;
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(
18
    using = AiAgentAskOrAiAgentReference.AiAgentAskOrAiAgentReferenceDeserializer.class)
19
@JsonSerialize(using = OneOfTwo.OneOfTwoSerializer.class)
20
public class AiAgentAskOrAiAgentReference extends OneOfTwo<AiAgentAsk, AiAgentReference> {
21

22
  protected final String type;
23

24
  public AiAgentAskOrAiAgentReference(AiAgentAsk aiAgentAsk) {
25
    super(aiAgentAsk, null);
1✔
26
    this.type = EnumWrapper.convertToString(aiAgentAsk.getType());
1✔
27
  }
1✔
28

29
  public AiAgentAskOrAiAgentReference(AiAgentReference aiAgentReference) {
30
    super(null, aiAgentReference);
1✔
31
    this.type = EnumWrapper.convertToString(aiAgentReference.getType());
1✔
32
  }
1✔
33

34
  public boolean isAiAgentAsk() {
NEW
35
    return value0 != null;
×
36
  }
37

38
  public AiAgentAsk getAiAgentAsk() {
39
    return value0;
×
40
  }
41

42
  public boolean isAiAgentReference() {
NEW
43
    return value1 != null;
×
44
  }
45

46
  public AiAgentReference getAiAgentReference() {
47
    return value1;
×
48
  }
49

50
  public String getType() {
NEW
51
    return type;
×
52
  }
53

54
  static class AiAgentAskOrAiAgentReferenceDeserializer
55
      extends JsonDeserializer<AiAgentAskOrAiAgentReference> {
56

57
    public AiAgentAskOrAiAgentReferenceDeserializer() {
58
      super();
×
59
    }
×
60

61
    @Override
62
    public AiAgentAskOrAiAgentReference deserialize(JsonParser jp, DeserializationContext ctxt)
63
        throws IOException {
64
      JsonNode node = JsonManager.jsonToSerializedData(jp);
×
65
      JsonNode discriminant0 = node.get("type");
×
66
      if (!(discriminant0 == null)) {
×
67
        switch (discriminant0.asText()) {
×
68
          case "ai_agent_ask":
69
            return new AiAgentAskOrAiAgentReference(
×
70
                JsonManager.deserialize(node, AiAgentAsk.class));
×
71
          case "ai_agent_id":
72
            return new AiAgentAskOrAiAgentReference(
×
73
                JsonManager.deserialize(node, AiAgentReference.class));
×
74
        }
75
      }
76
      throw new JsonMappingException(jp, "Unable to deserialize AiAgentAskOrAiAgentReference");
×
77
    }
78
  }
79
}
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