@@ -8,14 +8,17 @@ public final class SentryAttribute {
88 private final @ NotNull String name ;
99 private final @ Nullable SentryAttributeType type ;
1010 private final @ Nullable Object value ;
11+ private final int flattenDepth ;
1112
1213 private SentryAttribute (
1314 final @ NotNull String name ,
1415 final @ Nullable SentryAttributeType type ,
15- final @ Nullable Object value ) {
16+ final @ Nullable Object value ,
17+ final int flattenDepth ) {
1618 this .name = name ;
1719 this .type = type ;
1820 this .value = value ;
21+ this .flattenDepth = flattenDepth ;
1922 }
2023
2124 public @ NotNull String getName () {
@@ -30,28 +33,42 @@ private SentryAttribute(
3033 return value ;
3134 }
3235
36+ public int getFlattenDepth () {
37+ return flattenDepth ;
38+ }
39+
3340 public static @ NotNull SentryAttribute named (
3441 final @ NotNull String name , final @ Nullable Object value ) {
35- return new SentryAttribute (name , null , value );
42+ return new SentryAttribute (name , null , value , 0 );
43+ }
44+
45+ public static @ NotNull SentryAttribute flattened (
46+ final @ NotNull String name , final @ Nullable Object value ) {
47+ return new SentryAttribute (name , null , value , 1 );
48+ }
49+
50+ public static @ NotNull SentryAttribute flattened (
51+ final @ NotNull String name , final @ Nullable Object value , final int flattenDepth ) {
52+ return new SentryAttribute (name , null , value , flattenDepth );
3653 }
3754
3855 public static @ NotNull SentryAttribute booleanAttribute (
3956 final @ NotNull String name , final @ Nullable Boolean value ) {
40- return new SentryAttribute (name , SentryAttributeType .BOOLEAN , value );
57+ return new SentryAttribute (name , SentryAttributeType .BOOLEAN , value , 0 );
4158 }
4259
4360 public static @ NotNull SentryAttribute integerAttribute (
4461 final @ NotNull String name , final @ Nullable Integer value ) {
45- return new SentryAttribute (name , SentryAttributeType .INTEGER , value );
62+ return new SentryAttribute (name , SentryAttributeType .INTEGER , value , 0 );
4663 }
4764
4865 public static @ NotNull SentryAttribute doubleAttribute (
4966 final @ NotNull String name , final @ Nullable Double value ) {
50- return new SentryAttribute (name , SentryAttributeType .DOUBLE , value );
67+ return new SentryAttribute (name , SentryAttributeType .DOUBLE , value , 0 );
5168 }
5269
5370 public static @ NotNull SentryAttribute stringAttribute (
5471 final @ NotNull String name , final @ Nullable String value ) {
55- return new SentryAttribute (name , SentryAttributeType .STRING , value );
72+ return new SentryAttribute (name , SentryAttributeType .STRING , value , 0 );
5673 }
5774}
0 commit comments