| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| KimAttributeSet |
|
| 1.0909090909090908;1.091 | ||||
| KimAttributeSet$1 |
|
| 1.0909090909090908;1.091 | ||||
| KimAttributeSet$1$1 |
|
| 1.0909090909090908;1.091 | ||||
| KimAttributeSet$AttributeHolder |
|
| 1.0909090909090908;1.091 |
| 1 | /* | |
| 2 | * Copyright 2008-2009 The Kuali Foundation | |
| 3 | * | |
| 4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.opensource.org/licenses/ecl2.php | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | package org.kuali.rice.kim.bo.types; | |
| 17 | ||
| 18 | import java.util.Collections; | |
| 19 | import java.util.HashMap; | |
| 20 | import java.util.Iterator; | |
| 21 | import java.util.Map; | |
| 22 | import java.util.Set; | |
| 23 | ||
| 24 | /** | |
| 25 | * Immutable version of an attribute set - not used at present. | |
| 26 | * | |
| 27 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 28 | * | |
| 29 | */ | |
| 30 | @Deprecated | |
| 31 | public class KimAttributeSet implements Iterable<KimAttributeSet.AttributeHolder> { | |
| 32 | ||
| 33 | 0 | protected Map<String,String> attributes = new HashMap<String,String>(); |
| 34 | ||
| 35 | 0 | public KimAttributeSet( Map<String,String> attributes ) { |
| 36 | 0 | this.attributes.putAll( attributes ); |
| 37 | 0 | } |
| 38 | ||
| 39 | public String getValue( String name ) { | |
| 40 | 0 | return attributes.get( name ); |
| 41 | } | |
| 42 | ||
| 43 | public Set<String> getAttributeNames() { | |
| 44 | 0 | return Collections.unmodifiableSet( attributes.keySet() ); |
| 45 | } | |
| 46 | ||
| 47 | /** | |
| 48 | * @see java.lang.Iterable#iterator() | |
| 49 | */ | |
| 50 | public Iterator<AttributeHolder> iterator() { | |
| 51 | 0 | final Iterator<String> keySetIterator = attributes.keySet().iterator(); |
| 52 | 0 | return new Iterator<AttributeHolder>() { |
| 53 | /** | |
| 54 | * @see java.util.Iterator#hasNext() | |
| 55 | */ | |
| 56 | public boolean hasNext() { | |
| 57 | 0 | return keySetIterator.hasNext(); |
| 58 | } | |
| 59 | /** | |
| 60 | * @see java.util.Iterator#next() | |
| 61 | */ | |
| 62 | public AttributeHolder next() { | |
| 63 | 0 | final String key = keySetIterator.next(); |
| 64 | 0 | final String value = attributes.get( key ); |
| 65 | 0 | return new AttributeHolder() { |
| 66 | public String getName() { | |
| 67 | 0 | return key; |
| 68 | } | |
| 69 | public String getValue() { | |
| 70 | 0 | return value; |
| 71 | } | |
| 72 | }; | |
| 73 | } | |
| 74 | /** | |
| 75 | * @see java.util.Iterator#remove() | |
| 76 | */ | |
| 77 | public void remove() { | |
| 78 | 0 | throw new UnsupportedOperationException(); |
| 79 | } | |
| 80 | }; | |
| 81 | } | |
| 82 | ||
| 83 | public interface AttributeHolder { | |
| 84 | public String getName(); | |
| 85 | public String getValue(); | |
| 86 | } | |
| 87 | ||
| 88 | } |