@@ -65,7 +65,7 @@ public Message messageValue() {
65
65
public <T > T value (Class <T > clazz ) {
66
66
Descriptors .FieldDescriptor .Type type = fieldDescriptor .getType ();
67
67
if (fieldDescriptor .isMapField ()) {
68
- return clazz .cast (getMapBinding ());
68
+ return clazz .cast (mapValueAsObject ());
69
69
}
70
70
if (!fieldDescriptor .isRepeated ()
71
71
&& (type == Descriptors .FieldDescriptor .Type .UINT32
@@ -96,10 +96,18 @@ public List<Value> repeatedValue() {
96
96
return out ;
97
97
}
98
98
99
- // TODO - This is essentially the same functionality as `mapValue` except that it
100
- // returns a Map of Objects rather than a Map of protovalidate-java Value.
101
- // Trying to bind a Map of Values to a CEL variable (i.e. `this`) does not work
102
- // because CEL-Java doesn't know how to interpret that proprietary Value object.
99
+ // TODO - This should be refactored at some point.
100
+ //
101
+ // This is essentially the same functionality as `mapValue` except that it
102
+ // returns a Map of Objects rather than a Map of protovalidate-java Values.
103
+ // It is used for binding to a CEL variable (i.e. `this`).
104
+ // Trying to bind a Map of Values to a CEL variable does not work because
105
+ // CEL-Java doesn't know how to interpret that proprietary Value object.
106
+ //
107
+ // Ideally, we should be using CEL-Java's org.projectnessie.cel.common.types.ref.Val
108
+ // type instead of our own custom Value abstraction. However, since we are evaluating
109
+ // Java CEL implementations, we should probably wait until that decision is made before
110
+ // making such a large refactor. This should suffice as a stopgap until then.
103
111
private Map <Object , Object > mapValueAsObject () {
104
112
List <AbstractMessage > input =
105
113
value instanceof List
0 commit comments