1 22 package org.jboss.iiop.rmi.ir; 23 24 import org.omg.CORBA.TypeCode ; 25 import org.omg.CORBA.TypeCodePackage.BadKind ; 26 import org.omg.CORBA.TCKind ; 27 import org.omg.CORBA.DefinitionKind ; 28 29 35 abstract class IDLTypeImpl 36 extends IRObjectImpl 37 implements LocalIDLType 38 { 39 41 43 45 47 IDLTypeImpl(TypeCode typeCode, DefinitionKind def_kind, 48 RepositoryImpl repository) 49 { 50 super(def_kind, repository); 51 52 this.typeCode = typeCode; 53 } 54 55 57 59 public TypeCode type() 60 { 61 return typeCode; 62 } 63 64 66 69 static LocalIDLType getIDLType(TypeCode typeCode, RepositoryImpl repository) 70 { 71 TCKind tcKind = typeCode.kind(); 72 73 if (PrimitiveDefImpl.isPrimitiveTCKind(tcKind)) 74 return new PrimitiveDefImpl(typeCode, repository); 75 76 if (tcKind == TCKind.tk_sequence) 77 return repository.getSequenceImpl(typeCode); 78 79 if (tcKind == TCKind.tk_value || tcKind == TCKind.tk_value_box || 80 tcKind == TCKind.tk_alias || tcKind == TCKind.tk_struct || 81 tcKind == TCKind.tk_union || tcKind == TCKind.tk_enum || 82 tcKind == TCKind.tk_objref) { 83 try { 84 return (LocalIDLType)repository._lookup_id(typeCode.id()); 85 } catch (BadKind ex) { 86 throw new RuntimeException ("Bad kind for TypeCode.id()"); 87 } 88 } 89 90 throw new RuntimeException ("TODO: tcKind=" + tcKind.value()); 91 } 92 93 95 99 protected byte[] getObjectId() 100 { 101 return repository.getNextObjectId(); 102 } 103 104 106 109 private TypeCode typeCode; 110 111 } 112 113 | Popular Tags |