1 26 27 package org.objectweb.ccm.IDL3; 28 29 37 38 public class AliasDeclImpl 39 extends DeclarationImpl 40 implements TypeRef, AliasDecl 41 { 42 48 51 private org.omg.CORBA.AliasDef alias_def_; 52 53 56 private TypeRef original_type_; 57 58 64 69 protected 70 AliasDeclImpl(Repository rep, ScopeImpl parent) 71 { 72 super(rep, parent); 74 75 alias_def_ = null; 77 original_type_ = null; 78 the_declaration_kind_ = DeclarationKind._dk_alias; 79 } 80 81 87 92 protected void 93 load(org.omg.CORBA.Contained contained) 94 { 95 alias_def_ = org.omg.CORBA.AliasDefHelper.narrow(contained); 96 setType(getRepository().getAsTypeRef(alias_def_.original_type_def())); 97 super.load(contained); 98 } 99 100 105 protected void 106 loadAsMapping(org.omg.CORBA.Contained contained) 107 { 108 alias_def_ = org.omg.CORBA.AliasDefHelper.narrow(contained); 109 setType(getRepository().getAsMappedTypeRef(alias_def_.original_type_def())); 110 super.load(contained); 111 } 112 113 119 122 public void 123 create() 124 { 125 alias_def_ = the_parent_.getContainer().create_alias(getId(), getName(), getVersion(), 126 original_type_.getIDLType()); 127 128 super.create(); 129 } 130 131 138 public Declaration[] 139 getDependencies() 140 { 141 if (dependencies_!=null) 142 return dependencies_; 143 144 org.objectweb.ccm.util.Vector alias_depend = new org.objectweb.ccm.util.Vector(); 145 146 if (getType().isDeclaration()) 148 alias_depend.add(getType()); 149 150 Declaration[] depend = getType().getDependencies(); 151 for (int i=0;i<depend.length;i++) 152 alias_depend.add(depend[i]); 153 154 155 dependencies_ = (Declaration[])alias_depend.toArray(new Declaration[0]); 156 return dependencies_; 157 } 158 159 165 170 public org.omg.CORBA.IDLType 171 getIDLType() 172 { 173 return alias_def_; 174 } 175 176 179 public int 180 getTypeKind() 181 { 182 return TypeKind._tk_alias; 183 } 184 185 191 194 public TypeRef 195 getType() 196 { 197 return original_type_; 198 } 199 200 205 public void 206 setType(TypeRef type) 207 { 208 if(type != null) 209 { 210 original_type_ = type; 211 original_type_.addRef(); 212 } 213 } 214 215 221 224 public void 225 destroy() 226 { 227 if (original_type_!=null) 228 original_type_.removeRef(); 229 230 super.destroy(); 231 } 232 233 238 protected org.omg.CORBA.Contained 239 getContained() 240 { 241 return alias_def_; 242 } 243 } 244 | Popular Tags |