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

box / box-java-sdk-gen / #360

14 Jul 2025 11:20AM UTC coverage: 38.091% (+2.5%) from 35.58%
#360

push

github

web-flow
feat: Support common union fields and implicit union conversion (box/box-codegen#758) (#361)

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

21.43
/src/main/java/com/box/sdkgen/schemas/metadatainstancevalue/MetadataInstanceValue.java
1
package com.box.sdkgen.schemas.metadatainstancevalue;
2

3
import com.box.sdkgen.internal.OneOfFour;
4
import com.box.sdkgen.serialization.json.JsonManager;
5
import com.fasterxml.jackson.core.JsonParser;
6
import com.fasterxml.jackson.databind.DeserializationContext;
7
import com.fasterxml.jackson.databind.JsonDeserializer;
8
import com.fasterxml.jackson.databind.JsonMappingException;
9
import com.fasterxml.jackson.databind.JsonNode;
10
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
11
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
12
import java.io.IOException;
13
import java.util.List;
14

15
@JsonDeserialize(using = MetadataInstanceValue.MetadataInstanceValueDeserializer.class)
16
@JsonSerialize(using = OneOfFour.OneOfFourSerializer.class)
17
public class MetadataInstanceValue extends OneOfFour<String, Long, Double, List<String>> {
18

19
  public MetadataInstanceValue(String string) {
20
    super(string, null, null, null);
1✔
21
  }
1✔
22

23
  public MetadataInstanceValue(Long longNumber) {
24
    super(null, longNumber, null, null);
1✔
25
  }
1✔
26

27
  public MetadataInstanceValue(Double doubleNumber) {
28
    super(null, null, doubleNumber, null);
×
29
  }
×
30

31
  public MetadataInstanceValue(List<String> listOfString) {
32
    super(null, null, null, listOfString);
1✔
33
  }
1✔
34

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

39
  public String getString() {
40
    return value0;
×
41
  }
42

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

47
  public Long getLongNumber() {
48
    return value1;
×
49
  }
50

51
  public boolean isDoubleNumber() {
NEW
52
    return value2 != null;
×
53
  }
54

55
  public Double getDoubleNumber() {
56
    return value2;
×
57
  }
58

59
  public boolean isListOfString() {
NEW
60
    return value3 != null;
×
61
  }
62

63
  public List<String> getListOfString() {
64
    return value3;
×
65
  }
66

67
  static class MetadataInstanceValueDeserializer extends JsonDeserializer<MetadataInstanceValue> {
68

69
    public MetadataInstanceValueDeserializer() {
70
      super();
×
71
    }
×
72

73
    @Override
74
    public MetadataInstanceValue deserialize(JsonParser jp, DeserializationContext ctxt)
75
        throws IOException {
76
      JsonNode node = JsonManager.jsonToSerializedData(jp);
×
77
      try {
78
        return new MetadataInstanceValue(OneOfFour.OBJECT_MAPPER.convertValue(node, Long.class));
×
79
      } catch (Exception ignored) {
×
80
      }
81
      try {
82
        return new MetadataInstanceValue(OneOfFour.OBJECT_MAPPER.convertValue(node, Double.class));
×
83
      } catch (Exception ignored) {
×
84
      }
85
      try {
86
        return new MetadataInstanceValue(OneOfFour.OBJECT_MAPPER.convertValue(node, List.class));
×
87
      } catch (Exception ignored) {
×
88
      }
89
      try {
90
        return new MetadataInstanceValue(OneOfFour.OBJECT_MAPPER.convertValue(node, String.class));
×
91
      } catch (Exception ignored) {
×
92
      }
93
      throw new JsonMappingException(jp, "Unable to deserialize MetadataInstanceValue");
×
94
    }
95
  }
96
}
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