1 26 27 package org.objectweb.openccm.Containers; 28 29 36 37 public class PropertySetImpl 38 extends PropertyImpl 39 implements PropertySet 40 { 41 47 50 private org.objectweb.ccm.util.Vector set_; 51 52 58 62 public 63 PropertySetImpl(java.lang.String id) 64 { 65 super(id); 66 set_ = new org.objectweb.ccm.util.Vector(); 67 } 68 69 75 81 87 public PropertySet 88 add(Property prop) 89 { 90 set_.add(prop); 91 return this; 92 } 93 94 100 public Property 101 get(java.lang.String id) 102 throws UnknownProperty 103 { 104 java.util.Enumeration iter = set_.elements(); 105 Property prop = null; 106 while (iter.hasMoreElements()) 107 { 108 prop = (Property)iter.nextElement(); 109 if (prop.id().equals(id)) 110 return prop; 111 } 112 throw new UnknownProperty(); 113 } 114 115 121 public StringProperty 122 get_as_string(java.lang.String id) 123 throws UnknownProperty, BadPropertyKind 124 { 125 Property prop = get(id); 126 try 127 { 128 return (StringProperty)prop; 129 } 130 catch(java.lang.ClassCastException ex) 131 { 132 throw new BadPropertyKind(); 133 } 134 } 135 136 142 public PropertySet 143 get_as_set(String id) 144 throws UnknownProperty, BadPropertyKind 145 { 146 Property prop = get(id); 147 try 148 { 149 return (PropertySet)prop; 150 } 151 catch(java.lang.ClassCastException ex) 152 { 153 throw new BadPropertyKind(); 154 } 155 } 156 } 157 | Popular Tags |