1 26 27 package org.objectweb.openccm.ast.lib; 28 29 30 import org.objectweb.openccm.ast.api.DeclarationKind; 31 32 33 import org.objectweb.openccm.ast.api.Declaration; 34 35 36 import org.omg.CORBA.ValueMemberDef ; 37 import org.omg.CORBA.ValueMemberDefHelper; 38 39 66 67 public class ValueMemberDeclImpl 68 extends DeclarationWithTypeRefImpl 69 implements org.objectweb.openccm.ast.api.ValueMemberDecl 70 { 71 77 78 private ValueMemberDef value_member_def_; 79 80 81 private short access_; 82 83 89 95 protected 96 ValueMemberDeclImpl(Repository rep, 97 ScopeImpl parent) 98 { 99 super(rep, parent); 101 102 value_member_def_ = null; 104 type_ = null; 105 access_ = (short)0; 106 } 107 108 114 120 125 protected void 126 load(org.omg.CORBA.Contained contained) 127 { 128 value_member_def_ = ValueMemberDefHelper.narrow(contained); 129 setType(getRepository().getAsTypeRef(value_member_def_.type_def())); 130 access_ = value_member_def_.access(); 131 super.load(contained); 132 } 133 134 140 protected org.omg.CORBA.Contained 141 getContained() 142 { 143 return value_member_def_; 144 } 145 146 152 158 164 172 public Declaration[] 173 getDependencies() 174 { 175 if (dependencies_!=null) 176 return dependencies_; 177 178 java.util.List vmember_depend = new java.util.ArrayList (); 179 180 if (getType().isDeclaration()) 182 vmember_depend.add(getType()); 183 184 Declaration[] depend = getType().getDependencies(); 185 for (int i=0; i<depend.length; i++) 186 vmember_depend.add(depend[i]); 187 188 189 dependencies_ = (Declaration[])vmember_depend.toArray(new Declaration[0]); 190 return dependencies_; 191 } 192 193 199 204 public long 205 getDeclKind() 206 { 207 return DeclarationKind.dk_value_member; 208 } 209 210 213 public void 214 create() 215 { 216 value_member_def_ = the_parent_.getExtValueDef(). 218 create_value_member(getId(), 219 getName(), 220 getVersion(), 221 getIDLType(), 222 access_); 223 super.create(); 224 } 225 226 232 238 241 public void 242 setPublic() 243 { 244 access_ = (short)1; 245 } 246 247 252 public boolean 253 isPublic() 254 { 255 return access_ == (short)1; 256 } 257 258 261 public void 262 setPrivate() 263 { 264 access_ = (short)0; 265 } 266 267 272 public boolean 273 isPrivate() 274 { 275 return access_ == (short)0; 276 } 277 } 278 | Popular Tags |