-package org.simantics.scl.commands.internal.serialization;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.scl.commands.internal.StringConverterFactory;\r
-import org.simantics.scl.compiler.errors.CompilationErrorFormatter;\r
-import org.simantics.scl.compiler.module.repository.ImportFailureException;\r
-import org.simantics.scl.compiler.top.SCLExpressionCompilationException;\r
-import org.simantics.scl.compiler.types.Type;\r
-import org.simantics.scl.runtime.function.Function;\r
-import org.simantics.scl.runtime.function.Function2;\r
-\r
-public class CommandSerializerFactory {\r
- @SuppressWarnings("unchecked")\r
- public static CommandSerializer create(String name, Type[] parameterTypes) {\r
- Function2<Resource,Object,String>[] stringConverters = new Function[parameterTypes.length];\r
- for(int i=0;i<parameterTypes.length;++i) {\r
- try {\r
- stringConverters[i] = StringConverterFactory.stringConverterFor(parameterTypes[i]);\r
- } catch(SCLExpressionCompilationException e) {\r
- System.err.println("Failed to create a string converter for type " + parameterTypes[i] + ".");\r
- System.err.println(CompilationErrorFormatter.toString(e.getErrors()));\r
- return new ErrorSerializer(name);\r
- } catch (ImportFailureException e) {\r
- System.err.println("Failed to create a string converter for type " + parameterTypes[i] + ".");\r
- System.err.println("Didn't find Simantics/GShow/gshow.");\r
- return new ErrorSerializer(name);\r
- }\r
- }\r
- return new CommandSerializerImpl(name, stringConverters);\r
- }\r
-}\r
+package org.simantics.scl.commands.internal.serialization;
+
+import org.simantics.db.Resource;
+import org.simantics.scl.commands.internal.StringConverterFactory;
+import org.simantics.scl.compiler.errors.CompilationErrorFormatter;
+import org.simantics.scl.compiler.module.repository.ImportFailureException;
+import org.simantics.scl.compiler.top.SCLExpressionCompilationException;
+import org.simantics.scl.compiler.types.Type;
+import org.simantics.scl.runtime.function.Function;
+import org.simantics.scl.runtime.function.Function2;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CommandSerializerFactory {
+ private static final Logger LOGGER = LoggerFactory.getLogger(CommandSerializerFactory.class);
+ @SuppressWarnings("unchecked")
+ public static CommandSerializer create(String name, Type[] parameterTypes) {
+ Function2<Resource,Object,String>[] stringConverters = new Function[parameterTypes.length];
+ for(int i=0;i<parameterTypes.length;++i) {
+ try {
+ stringConverters[i] = StringConverterFactory.stringConverterFor(parameterTypes[i]);
+ } catch(SCLExpressionCompilationException e) {
+ LOGGER.error("Failed to create a string converter for type " + parameterTypes[i] + ".");
+ LOGGER.error(CompilationErrorFormatter.toString(e.getErrors()), e);
+ return new ErrorSerializer(name);
+ } catch (ImportFailureException e) {
+ LOGGER.error("Failed to create a string converter for type " + parameterTypes[i] + ".");
+ LOGGER.error("Didn't find Simantics/GShow/gshow.", e);
+ return new ErrorSerializer(name);
+ }
+ }
+ return new CommandSerializerImpl(name, stringConverters);
+ }
+}