Commit d2f1aa22a02c4a4aab5af8b4d40c434384d5c94c

Authored by Cleverson Sacramento
1 parent ba206cbf
Exists in master

Refatoração do Faces.getConverter(...)

impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/util/Faces.java
@@ -145,19 +145,20 @@ public class Faces { @@ -145,19 +145,20 @@ public class Faces {
145 return result; 145 return result;
146 } 146 }
147 147
148 - public static Converter getConverter(Class<?> clazz) {  
149 - FacesContext context = getFacesContext();  
150 - if (clazz == null) {  
151 - return null;  
152 - } 148 + public static Converter getConverter(Class<?> targetClass) {
  149 + Converter result;
  150 +
153 try { 151 try {
154 - Application application = context.getApplication();  
155 - return application.createConverter(clazz); 152 + Application application = getFacesContext().getApplication();
  153 + result = application.createConverter(targetClass);
  154 +
156 } catch (Exception e) { 155 } catch (Exception e) {
157 - return null; 156 + result = null;
158 } 157 }
  158 +
  159 + return result;
159 } 160 }
160 - 161 +
161 public static Map<String, Object> getViewMap() { 162 public static Map<String, Object> getViewMap() {
162 UIViewRoot viewRoot = getFacesContext().getViewRoot(); 163 UIViewRoot viewRoot = getFacesContext().getViewRoot();
163 return viewRoot.getViewMap(true); 164 return viewRoot.getViewMap(true);