static _nTIB() { voidType = typeof(void); tibTable = new global::System.Collections.Generic.Dictionary<global::System.Type, _nTIB>(); bootstrapTable = new System.Collections.Generic.Dictionary<java.lang.String, _nTIB>(); jNameTable = new System.Collections.Generic.Dictionary<string,_nTIB>(); //inBootstrap = true; _nTIB voidTib = new _nTIB(voidType, "void"); tibTable.Add(voidType, voidTib); jNameTable.Add("void", voidTib); bootstrapSetClass(voidTib); _nTIB booleanTib = new _nTIB(booleanType, "boolean"); tibTable.Add(booleanType, booleanTib); jNameTable.Add("boolean", booleanTib); bootstrapSetClass(booleanTib); _nTIB byteTib = new _nTIB(byteType, "byte"); tibTable.Add(byteType, byteTib); jNameTable.Add("byte", byteTib); bootstrapSetClass(byteTib); _nTIB charTib = new _nTIB(charType, "char"); tibTable.Add(charType, charTib); jNameTable.Add("char", charTib); bootstrapSetClass(charTib); _nTIB shortTib = new _nTIB(shortType, "short"); tibTable.Add(shortType, shortTib); jNameTable.Add("short", shortTib); bootstrapSetClass(shortTib); _nTIB intTib = new _nTIB(intType, "int"); tibTable.Add(intType, intTib); jNameTable.Add("int", intTib); bootstrapSetClass(intTib); _nTIB longTib = new _nTIB(longType, "long"); tibTable.Add(longType, longTib); jNameTable.Add("long", longTib); bootstrapSetClass(longTib); _nTIB floatTib = new _nTIB(floatType, "float"); tibTable.Add(floatType, floatTib); jNameTable.Add("float", floatTib); bootstrapSetClass(floatTib); _nTIB doubleTib = new _nTIB(doubleType, "double"); tibTable.Add(doubleType, doubleTib); jNameTable.Add("double", doubleTib); bootstrapSetClass(doubleTib); _nTIB objectTib = new _nTIB(objectType, "java.lang.Object"); tibTable.Add(objectType, objectTib); jNameTable.Add("java.lang.Object", objectTib); bootstrapSetClass(objectTib); _nTIB booleanArrayTib = new _nTIB(booleanArrayType, "[Z"); tibTable.Add(booleanArrayType, booleanArrayTib); jNameTable.Add("[Z", booleanArrayTib); bootstrapSetClass(booleanArrayTib); booleanArrayTib.setComponentTIB(booleanTib); _nTIB byteArrayTib = new _nTIB(byteArrayType, "[B"); tibTable.Add(byteArrayType, byteArrayTib); jNameTable.Add("[B", byteArrayTib); bootstrapSetClass(byteArrayTib); byteArrayTib.setComponentTIB(byteTib); _nTIB charArrayTib = new _nTIB(charArrayType, "[C"); tibTable.Add(charArrayType, charArrayTib); jNameTable.Add("[C", charArrayTib); bootstrapSetClass(charArrayTib); charArrayTib.setComponentTIB(charTib); _nTIB shortArrayTib = new _nTIB(shortArrayType, "[S"); tibTable.Add(shortArrayType, shortArrayTib); jNameTable.Add("[S", shortArrayTib); bootstrapSetClass(shortArrayTib); shortArrayTib.setComponentTIB(shortTib); _nTIB intArrayTib = new _nTIB(intArrayType, "[I"); tibTable.Add(intArrayType, intArrayTib); jNameTable.Add("[I", intArrayTib); bootstrapSetClass(intArrayTib); intArrayTib.setComponentTIB(intTib); _nTIB longArrayTib = new _nTIB(longArrayType, "[J"); tibTable.Add(longArrayType, longArrayTib); jNameTable.Add("[J", longArrayTib); bootstrapSetClass(longArrayTib); longArrayTib.setComponentTIB(longTib); _nTIB floatArrayTib = new _nTIB(floatArrayType, "[F"); tibTable.Add(floatArrayType, floatArrayTib); jNameTable.Add("[F", floatArrayTib); bootstrapSetClass(floatArrayTib); floatArrayTib.setComponentTIB(floatTib); _nTIB doubleArrayTib = new _nTIB(doubleArrayType, "[D"); tibTable.Add(doubleArrayType, doubleArrayTib); jNameTable.Add("[D", doubleArrayTib); bootstrapSetClass(doubleArrayTib); doubleArrayTib.setComponentTIB(doubleTib); _nTIB objectArrayTib = new _nTIB(objectArrayType, "[Ljava.lang.Object"); tibTable.Add(objectArrayType, objectArrayTib); jNameTable.Add("[Ljava.lang.Object", objectArrayTib); bootstrapSetClass(objectArrayTib); objectArrayTib.setComponentTIB(objectTib); }
private void setComponentTIB(_nTIB componentTIB) { this.componentTIB = componentTIB; }
private static void bootstrapSetClass(_nTIB tib) { // note we do not really need: // java.lang.String javaTypeStr = nativeTypeToJavaTypeName(aType); // because we will be called back soon to get the TIB. // so let's store a dummy: java.lang.String dummy = new java.lang.String(); dummy.@this(); bootstrapTable.Add(dummy, tib); java.lang.Class.forName(dummy); // this will set the class of the tib }
public static java.lang.String nativeTypeToJavaTypeName(global::System.Type nativeType) { string result; _nTIB tib; if(!tibTable.TryGetValue(nativeType, out tib)) { // if it is not already in the table, // then the native type name is the same as the java counterpart result = nativeType.ToString(); tib = new _nTIB(nativeType, result); tibTable.Add(nativeType, tib); jNameTable.Add(result, tib); bootstrapSetClass(tib); } else { result = tib.getJavaName(); } return org.xmlvm._nUtil.toJavaString(result); }
// enforces a bijection Type-->_nTIB: public static _nTIB getTIB(global::System.Type myType, string jTypeName) { _nTIB result; if (!tibTable.TryGetValue(myType, out result)) { result = new _nTIB(myType, jTypeName); tibTable.Add(myType,result); } return result; }
private _nTIB(global::System.Type myType, string javaName) { this.myType = myType; this.javaName = javaName; this.componentTIB = null; }