git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve cbz support:
[fanfix.git]
/
src
/
be
/
nikiroo
/
fanfix
/
output
/
BasicOutput.java
diff --git
a/src/be/nikiroo/fanfix/output/BasicOutput.java
b/src/be/nikiroo/fanfix/output/BasicOutput.java
index 4607827b14e8010e98b844d0becd3c3df2e61463..036a1564d0a594eae2e4d758f0dd16f40a3fcd44 100644
(file)
--- 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
/**
* 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
* exception.
*
* @param typeName
* the possible type name
+ * @param def
+ * the default value
*
* @return NULL or the type
*/
*
* @return NULL or the type
*/
- public static OutputType valueOfNullOkUC(String typeName) {
+ public static OutputType valueOfNullOkUC(String typeName
, OutputType def
) {
if (typeName == null || typeName.isEmpty()) {
if (typeName == null || typeName.isEmpty()) {
- return
null
;
+ return
def
;
}
return OutputType.valueOfUC(typeName);
}
return OutputType.valueOfUC(typeName);
@@
-128,19
+130,20
@@
public abstract class BasicOutput {
/**
* Call {@link OutputType#valueOf(String)} after conversion to upper
/**
* 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 typeName
* the possible type name
+ * @param def
+ * the default value
*
* @return NULL or the type
*/
*
* @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) {
try {
return OutputType.valueOfUC(typeName);
} catch (Exception e) {
- return
null
;
+ return
def
;
}
}
}
}
}
}