X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Foutput%2FBasicOutput.java;fp=src%2Fbe%2Fnikiroo%2Ffanfix%2Foutput%2FBasicOutput.java;h=036a1564d0a594eae2e4d758f0dd16f40a3fcd44;hb=e604986c4208da0091d26bc0e1c4feb4ff3c588f;hp=4607827b14e8010e98b844d0becd3c3df2e61463;hpb=99ccbdf63b539f1f40e070f5833f2d15fcf79830;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/output/BasicOutput.java b/src/be/nikiroo/fanfix/output/BasicOutput.java index 4607827..036a156 100644 --- a/src/be/nikiroo/fanfix/output/BasicOutput.java +++ b/src/be/nikiroo/fanfix/output/BasicOutput.java @@ -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; } } }