1 26 27 package org.objectweb.openccm.ast.lib; 28 29 30 import org.objectweb.openccm.ast.api.TypeKind; 31 32 33 import org.objectweb.openccm.ast.api.DeclarationKind; 34 35 36 import org.objectweb.openccm.ast.api.Declaration; 37 38 39 import org.omg.CORBA.AliasDef ; 40 import org.omg.CORBA.AliasDefHelper; 41 42 54 55 public class AliasDeclImpl 56 extends DeclarationWithTypeRefImpl 57 implements org.objectweb.openccm.ast.api.AliasDecl, 58 IDLTypeWrapper 59 { 60 66 67 private AliasDef alias_def_; 68 69 75 81 protected 82 AliasDeclImpl(Repository rep, 83 ScopeImpl parent) 84 { 85 super(rep, parent); 87 88 alias_def_ = null; 90 } 91 92 98 104 109 protected void 110 load(org.omg.CORBA.Contained contained) 111 { 112 alias_def_ = AliasDefHelper.narrow(contained); 113 setType(getRepository().getAsTypeRef(alias_def_.original_type_def())); 114 super.load(contained); 115 } 116 117 122 protected void 123 loadAsMapping(org.omg.CORBA.Contained contained) 124 { 125 alias_def_ = AliasDefHelper.narrow(contained); 126 setType(getRepository().getAsMappedTypeRef(alias_def_. 127 original_type_def())); 128 super.load(contained); 129 } 130 131 136 protected org.omg.CORBA.Contained 137 getContained() 138 { 139 return alias_def_; 140 } 141 142 148 154 162 public Declaration[] 163 getDependencies() 164 { 165 if (dependencies_!=null) 166 return dependencies_; 167 168 java.util.List alias_depend = new java.util.ArrayList (); 169 170 if (getType().isDeclaration()) 172 alias_depend.add(getType()); 173 174 Declaration[] depend = getType().getDependencies(); 175 for (int i=0; i<depend.length; i++) 176 alias_depend.add(depend[i]); 177 178 dependencies_ = (Declaration[])alias_depend.toArray(new Declaration[0]); 179 return dependencies_; 180 } 181 182 188 193 public long 194 getDeclKind() 195 { 196 return DeclarationKind.dk_alias; 197 } 198 199 202 public void 203 create() 204 { 205 alias_def_ = the_parent_.getContainer(). 206 create_alias(getId(), getName(), getVersion(), super.getIDLType()); 207 super.create(); 208 } 209 210 216 221 public TypeKind 222 getTypeKind() 223 { 224 return TypeKind.tk_alias; 225 } 226 227 233 239 244 public org.omg.CORBA.IDLType 245 getIDLType() 246 { 247 return alias_def_; 248 } 249 } 250 | Popular Tags |