Commit d2f1aa22a02c4a4aab5af8b4d40c434384d5c94c
1 parent
ba206cbf
Exists in
master
Refatoração do Faces.getConverter(...)
Showing
1 changed file
with
10 additions
and
9 deletions
Show diff stats
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/util/Faces.java
... | ... | @@ -145,19 +145,20 @@ public class Faces { |
145 | 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 | 151 | try { |
154 | - Application application = context.getApplication(); | |
155 | - return application.createConverter(clazz); | |
152 | + Application application = getFacesContext().getApplication(); | |
153 | + result = application.createConverter(targetClass); | |
154 | + | |
156 | 155 | } catch (Exception e) { |
157 | - return null; | |
156 | + result = null; | |
158 | 157 | } |
158 | + | |
159 | + return result; | |
159 | 160 | } |
160 | - | |
161 | + | |
161 | 162 | public static Map<String, Object> getViewMap() { |
162 | 163 | UIViewRoot viewRoot = getFacesContext().getViewRoot(); |
163 | 164 | return viewRoot.getViewMap(true); | ... | ... |