Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DROOLS-7639] ansible-rulebook : support event path for collecting el… #124

Merged
merged 5 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.drools.ansible.rulebook.integration.api;

import java.util.List;
import java.util.Map;
import java.util.Set;

public class LogUtil {

Expand All @@ -10,18 +12,23 @@ private LogUtil() {

// convert java class to python class
private static Map<Class<?>, String> convertMap = Map.of(
java.lang.Integer.class, "int",
java.lang.Boolean.class, "bool",
java.lang.String.class, "str",
java.lang.Double.class, "float",
java.util.List.class, "list",
java.util.ArrayList.class, "list",
java.util.Map.class, "dict",
java.util.LinkedHashMap.class, "dict",
java.util.HashMap.class, "dict"
Integer.class, "int",
Boolean.class, "bool",
String.class, "str",
Double.class, "float"
);

public static String convertJavaClassToPythonClass(Class<?> javaClass) {
return convertMap.getOrDefault(javaClass, javaClass.getSimpleName());
if (convertMap.containsKey(javaClass)) {
return convertMap.get(javaClass);
}
if (List.class.isAssignableFrom(javaClass)) {
tkobayas marked this conversation as resolved.
Show resolved Hide resolved
return "list";
} else if (Map.class.isAssignableFrom(javaClass)) {
return "dict";
} else if (Set.class.isAssignableFrom(javaClass)) {
return "set";
}
return javaClass.getSimpleName();
}
}
Loading
Loading