Some fixes: output types, libraries, remote
[fanfix.git] / src / be / nikiroo / fanfix / output / BasicOutput.java
index 4607827b14e8010e98b844d0becd3c3df2e61463..036a1564d0a594eae2e4d758f0dd16f40a3fcd44 100644 (file)
@@ -110,17 +110,19 @@ public abstract class BasicOutput {
 
                /**
                 * Call {@link OutputType#valueOf(String)} after conversion to upper
-                * case but return NULL for NULL and empty instead of raising an
+                * case but return def for NULL and empty instead of raising an
                 * exception.
                 * 
                 * @param typeName
                 *            the possible type name
+                * @param def
+                *            the default value
                 * 
                 * @return NULL or the type
                 */
-               public static OutputType valueOfNullOkUC(String typeName) {
+               public static OutputType valueOfNullOkUC(String typeName, OutputType def) {
                        if (typeName == null || typeName.isEmpty()) {
-                               return null;
+                               return def;
                        }
 
                        return OutputType.valueOfUC(typeName);
@@ -128,19 +130,20 @@ public abstract class BasicOutput {
 
                /**
                 * Call {@link OutputType#valueOf(String)} after conversion to upper
-                * case but return NULL in case of error instead of raising an
-                * exception.
+                * case but return def in case of error instead of raising an exception.
                 * 
                 * @param typeName
                 *            the possible type name
+                * @param def
+                *            the default value
                 * 
                 * @return NULL or the type
                 */
-               public static OutputType valueOfAllOkUC(String typeName) {
+               public static OutputType valueOfAllOkUC(String typeName, OutputType def) {
                        try {
                                return OutputType.valueOfUC(typeName);
                        } catch (Exception e) {
-                               return null;
+                               return def;
                        }
                }
        }