@@ -118,29 +118,18 @@ public void setRuntimeOptions(CelRuntimeBuilder runtimeBuilder) {
118118 @ Override
119119 public void setRuntimeOptions (
120120 CelRuntimeBuilder runtimeBuilder , RuntimeEquality runtimeEquality , CelOptions celOptions ) {
121- for (Function function : functions ) {
122- for (CelOverloadDecl overload : function .functionDecl .overloads ()) {
123- switch (overload .overloadId ()) {
124- case MAP_INSERT_OVERLOAD_MAP_MAP :
125- runtimeBuilder .addFunctionBindings (
126- CelFunctionBinding .from (
127- MAP_INSERT_OVERLOAD_MAP_MAP ,
128- Map .class ,
129- Map .class ,
130- (map1 , map2 ) -> mapInsertMap (map1 , map2 , runtimeEquality )));
131- break ;
132- case MAP_INSERT_OVERLOAD_KEY_VALUE :
133- runtimeBuilder .addFunctionBindings (
134- CelFunctionBinding .from (
135- MAP_INSERT_OVERLOAD_KEY_VALUE ,
136- ImmutableList .of (Map .class , Object .class , Object .class ),
137- args -> mapInsertKeyValue (args , runtimeEquality )));
138- break ;
139- default :
140- // Nothing to add.
141- }
142- }
143- }
121+ runtimeBuilder .addFunctionBindings (
122+ CelFunctionBinding .fromOverloads (
123+ MAP_INSERT_FUNCTION ,
124+ CelFunctionBinding .from (
125+ MAP_INSERT_OVERLOAD_MAP_MAP ,
126+ Map .class ,
127+ Map .class ,
128+ (map1 , map2 ) -> mapInsertMap (map1 , map2 , runtimeEquality )),
129+ CelFunctionBinding .from (
130+ MAP_INSERT_OVERLOAD_KEY_VALUE ,
131+ ImmutableList .of (Map .class , Object .class , Object .class ),
132+ args -> mapInsertKeyValue (args , runtimeEquality ))));
144133 }
145134
146135 @ Override
0 commit comments