Converted to use guard clause to reduce nesting.

This commit is contained in:
Luke Taylor 2007-11-11 19:22:51 +00:00
parent 756be6fed3
commit 28a138f8ec

View File

@ -54,8 +54,11 @@ public class FilterInvocationDefinitionSourceEditor extends PropertyEditorSuppor
if ((s == null) || "".equals(s)) { if ((s == null) || "".equals(s)) {
// Leave target object empty // Leave target object empty
source.setDecorated(new RegExpBasedFilterInvocationDefinitionMap()); setValue(new RegExpBasedFilterInvocationDefinitionMap());
} else {
return;
}
// Check if we need to override the default definition map // Check if we need to override the default definition map
if (s.lastIndexOf(DIRECTIVE_PATTERN_TYPE_APACHE_ANT) != -1) { if (s.lastIndexOf(DIRECTIVE_PATTERN_TYPE_APACHE_ANT) != -1) {
source.setDecorated(new PathBasedFilterInvocationDefinitionMap()); source.setDecorated(new PathBasedFilterInvocationDefinitionMap());
@ -161,8 +164,7 @@ public class FilterInvocationDefinitionSourceEditor extends PropertyEditorSuppor
FilterInvocationDefinitionSourceMapping mapping = new FilterInvocationDefinitionSourceMapping(); FilterInvocationDefinitionSourceMapping mapping = new FilterInvocationDefinitionSourceMapping();
mapping.setUrl(name); mapping.setUrl(name);
String[] tokens = org.springframework.util.StringUtils String[] tokens = StringUtils.commaDelimitedListToStringArray(value);
.commaDelimitedListToStringArray(value);
for (int i = 0; i < tokens.length; i++) { for (int i = 0; i < tokens.length; i++) {
mapping.addConfigAttribute(tokens[i].trim()); mapping.addConfigAttribute(tokens[i].trim());
@ -171,7 +173,7 @@ public class FilterInvocationDefinitionSourceEditor extends PropertyEditorSuppor
mappings.add(mapping); mappings.add(mapping);
} }
source.setMappings(mappings); source.setMappings(mappings);
}
setValue(source.getDecorated()); setValue(source.getDecorated());
} }