File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
server/libs/core/evaluator/evaluator-impl/src/main/java/com/bytechef/evaluator Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -33,13 +33,23 @@ class Contains implements MethodExecutor {
3333
3434 @ Override
3535 public TypedValue execute (EvaluationContext context , Object target , Object ... arguments ) throws AccessException {
36- List <?> l1 = (List <?>) arguments [0 ];
37- Object value = arguments [1 ];
36+ Object firstArgument = arguments [0 ];
3837
39- if (l1 == null ) {
38+ if (firstArgument == null ) {
4039 return new TypedValue (false );
41- }
40+ } else {
41+ if (firstArgument instanceof List <?> list ) {
42+ Object value = arguments [1 ];
43+
44+ return new TypedValue (list .contains (value ));
45+ } else if (firstArgument instanceof String string ) {
46+ String substring = (String ) arguments [1 ];
4247
43- return new TypedValue (l1 .contains (value ));
48+ return new TypedValue (string .contains (substring ));
49+ } else {
50+ throw new IllegalArgumentException (
51+ "Invalid arguments for contains. Expected 2 string or list and element." );
52+ }
53+ }
4454 }
4555}
You can’t perform that action at this time.
0 commit comments