use of org.mule.runtime.core.internal.transformer.simple.StringToEnum in project mule by mulesoft.
the class ExtensionActivator method registerEnumTransformers.
private void registerEnumTransformers(ExtensionModel extensionModel) {
ClassLoader classLoader = getClassLoader(extensionModel);
Set<Class<?>> parameterClasses = new HashSet<>();
parameterClasses.addAll(getParameterClasses(extensionModel, classLoader));
parameterClasses.addAll(getSubtypeClasses(extensionModel, classLoader));
parameterClasses.stream().filter(type -> Enum.class.isAssignableFrom(type)).forEach(type -> {
final Class<Enum> enumClass = (Class<Enum>) type;
if (enumTypes.add(enumClass)) {
try {
StringToEnum stringToEnum = new StringToEnum(enumClass);
registerObject(muleContext, getName(stringToEnum), stringToEnum, Transformer.class);
} catch (MuleException e) {
throw new MuleRuntimeException(createStaticMessage("Could not register transformer for enum " + enumClass.getName()), e);
}
}
});
}
Aggregations