From: Walter M. <wal...@us...> - 2007-09-09 11:02:57
|
User: walterim Date: 07/09/09 04:02:58 Modified: andromda-jsf2/src/main/resources/templates/jsf2/converters EnumerationConverter.java.vsl Log: Support to other enumeration types than String Revision Changes Path 1.2 +4 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/converters/EnumerationConverter.java.vsl Index: EnumerationConverter.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/converters/EnumerationConverter.java.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- EnumerationConverter.java.vsl 5 Dec 2006 19:39:15 -0000 1.1 +++ EnumerationConverter.java.vsl 9 Sep 2007 11:02:58 -0000 1.2 @@ -30,7 +30,9 @@ java.lang.String value) throws javax.faces.convert.ConverterException { -#if ($enumeration.literalType.primitive) +#if(${enumeration.literalType.fullyQualifiedName} == "java.lang.String") + return value != null && value.trim().length() > 0 ? ${enumeration.fullyQualifiedName}.${enumeration.fromOperationName}(value) : null; +#elseif ($enumeration.literalType.primitive) try { #set ($parseSuffix = $stringUtils.capitalize($enumeration.literalType.name)) ${enumeration.literalType.fullyQualifiedName} v = ${enumeration.literalType.wrapperName}.parse${parseSuffix}(value); @@ -39,7 +41,7 @@ throw new javax.faces.convert.ConverterException(ex); } #else - return value != null && value.trim().length() > 0 ? ${enumeration.fullyQualifiedName}.${enumeration.fromOperationName}(value) : null; + return value != null && value.trim().length() > 0 ? ${enumeration.fullyQualifiedName}.${enumeration.fromOperationName}(new ${enumeration.literalType.fullyQualifiedName}(value)) : null; #end } } |