Clover coverage report - Acegi Security System for Spring - 1.0.0-RC1
Coverage timestamp: Mon Dec 5 2005 09:05:15 EST
file stats: LOC: 53   Methods: 1
NCLOC: 18   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ConfigAttributeEditor.java 100% 100% 100% 100%
coverage
 1    /* Copyright 2004 Acegi Technology Pty Limited
 2    *
 3    * Licensed under the Apache License, Version 2.0 (the "License");
 4    * you may not use this file except in compliance with the License.
 5    * You may obtain a copy of the License at
 6    *
 7    * http://www.apache.org/licenses/LICENSE-2.0
 8    *
 9    * Unless required by applicable law or agreed to in writing, software
 10    * distributed under the License is distributed on an "AS IS" BASIS,
 11    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12    * See the License for the specific language governing permissions and
 13    * limitations under the License.
 14    */
 15   
 16    package org.acegisecurity;
 17   
 18    import org.springframework.util.StringUtils;
 19   
 20    import java.beans.PropertyEditorSupport;
 21   
 22   
 23    /**
 24    * A property editor that can create a populated {@link
 25    * ConfigAttributeDefinition} from a comma separated list of values.
 26    *
 27    * <P>
 28    * Trims preceding and trailing spaces from presented command separated tokens,
 29    * as this can be a source of hard-to-spot configuration issues for end users.
 30    * </p>
 31    *
 32    * @author Ben Alex
 33    * @version $Id: ConfigAttributeEditor.java,v 1.4 2005/11/17 00:55:49 benalex Exp $
 34    */
 35    public class ConfigAttributeEditor extends PropertyEditorSupport {
 36    //~ Methods ================================================================
 37   
 38  112 public void setAsText(String s) throws IllegalArgumentException {
 39  112 if ((s == null) || "".equals(s)) {
 40  2 setValue(null);
 41    } else {
 42  110 String[] tokens = StringUtils.commaDelimitedListToStringArray(s);
 43  110 ConfigAttributeDefinition configDefinition = new ConfigAttributeDefinition();
 44   
 45  110 for (int i = 0; i < tokens.length; i++) {
 46  178 configDefinition.addConfigAttribute(new SecurityConfig(
 47    tokens[i].trim()));
 48    }
 49   
 50  110 setValue(configDefinition);
 51    }
 52    }
 53    }