@Test public void printAsJsonTest() { JsonElement result = JsonParser.parse(teDouble.printAsJson()); assertTrue(result.isJsonObject()); JsonObject teDoubleJson = result.getAsJsonObject(); assertEquals("de.monticore.types.check.SymTypeConstant", teDoubleJson.getStringMember("kind")); assertEquals("double", teDoubleJson.getStringMember("constName")); result = JsonParser.parse(teInt.printAsJson()); assertTrue(result.isJsonObject()); JsonObject teIntJson = result.getAsJsonObject(); assertEquals("de.monticore.types.check.SymTypeConstant", teIntJson.getStringMember("kind")); assertEquals("int", teIntJson.getStringMember("constName")); result = JsonParser.parse(teVarA.printAsJson()); assertTrue(result.isJsonObject()); JsonObject teVarAJson = result.getAsJsonObject(); assertEquals("de.monticore.types.check.SymTypeVariable", teVarAJson.getStringMember("kind")); assertEquals("A", teVarAJson.getStringMember("varName")); result = JsonParser.parse(teP.printAsJson()); assertTrue(result.isJsonObject()); JsonObject tePJson = result.getAsJsonObject(); assertEquals("de.monticore.types.check.SymTypeOfObject", tePJson.getStringMember("kind")); assertEquals("de.x.Person", tePJson.getStringMember("objName")); result = JsonParser.parse(teVoid.printAsJson()); assertTrue(result.isJsonString()); assertEquals("voidType", result.getAsJsonString().getValue()); result = JsonParser.parse(teNull.printAsJson()); assertTrue(result.isJsonString()); assertEquals("nullType", result.getAsJsonString().getValue()); result = JsonParser.parse(teArr1.printAsJson()); assertTrue(result.isJsonObject()); JsonObject teArr1Json = result.getAsJsonObject(); assertEquals("de.monticore.types.check.SymTypeArray", teArr1Json.getStringMember("kind")); assertEquals(1, teArr1Json.getIntegerMember("dim"), 0.01); JsonObject teArr1ArgJson = teArr1Json.getObjectMember("argument"); assertEquals("de.monticore.types.check.SymTypeOfObject", teArr1ArgJson.getStringMember("kind")); assertEquals("Human", teArr1ArgJson.getStringMember("objName")); result = JsonParser.parse(teArr3.printAsJson()); assertTrue(result.isJsonObject()); JsonObject teArr3Json = result.getAsJsonObject(); assertEquals("de.monticore.types.check.SymTypeArray", teArr3Json.getStringMember("kind")); assertEquals(3, teArr3Json.getIntegerMember("dim"), 0.01); JsonObject teArr3ArgJson = teArr3Json.getObjectMember("argument"); assertEquals("de.monticore.types.check.SymTypeConstant", teArr3ArgJson.getStringMember("kind")); assertEquals("int", teArr3ArgJson.getStringMember("constName")); result = JsonParser.parse(teSet.printAsJson()); assertTrue(result.isJsonObject()); JsonObject teSetJson = result.getAsJsonObject(); assertEquals("de.monticore.types.check.SymTypeOfGenerics", teSetJson.getStringMember("kind")); assertEquals("java.util.Set", teSetJson.getStringMember("typeConstructorFullName")); List<JsonElement> teSetArgsJson = teSetJson.getArrayMember("arguments"); assertEquals(1, teSetArgsJson.size(), 0.01); assertEquals("de.monticore.types.check.SymTypeOfObject", teSetArgsJson.get(0).getAsJsonObject().getStringMember("kind")); assertEquals("de.x.Person", teSetArgsJson.get(0).getAsJsonObject().getStringMember("objName")); result = JsonParser.parse(teSetA.printAsJson()); assertTrue(result.isJsonObject()); JsonObject teSetAJson = result.getAsJsonObject(); assertEquals("de.monticore.types.check.SymTypeOfGenerics", teSetAJson.getStringMember("kind")); assertEquals("java.util.Set", teSetAJson.getStringMember("typeConstructorFullName")); List<JsonElement> teSetAArgsJson = teSetAJson.getArrayMember("arguments"); assertEquals(1, teSetAArgsJson.size(), 0.01); assertEquals("de.monticore.types.check.SymTypeVariable", teSetAArgsJson.get(0).getAsJsonObject().getStringMember("kind")); assertEquals("A", teSetAArgsJson.get(0).getAsJsonObject().getStringMember("varName")); result = JsonParser.parse(teMap.printAsJson()); assertTrue(result.isJsonObject()); JsonObject teMapJson = result.getAsJsonObject(); assertEquals("de.monticore.types.check.SymTypeOfGenerics", teMapJson.getStringMember("kind")); assertEquals("Map", teMapJson.getStringMember("typeConstructorFullName")); List<JsonElement> teMapArgsJson = teMapJson.getArrayMember("arguments"); assertEquals(2, teMapArgsJson.size(), 0.01); assertEquals("de.monticore.types.check.SymTypeConstant", teMapArgsJson.get(0).getAsJsonObject().getStringMember("kind")); assertEquals("int", teMapArgsJson.get(0).getAsJsonObject().getStringMember("constName")); assertEquals("de.monticore.types.check.SymTypeOfObject", teMapArgsJson.get(1).getAsJsonObject().getStringMember("kind")); assertEquals("de.x.Person", teMapArgsJson.get(1).getAsJsonObject().getStringMember("objName")); result = JsonParser.parse(teFoo.printAsJson()); assertTrue(result.isJsonObject()); JsonObject teFooJson = result.getAsJsonObject(); assertEquals("de.monticore.types.check.SymTypeOfGenerics", teFooJson.getStringMember("kind")); assertEquals("x.Foo", teFooJson.getStringMember("typeConstructorFullName")); List<JsonElement> teFooArgsJson = teFooJson.getArrayMember("arguments"); assertEquals(4, teFooArgsJson.size(), 0.01); assertEquals("de.monticore.types.check.SymTypeOfObject", teFooArgsJson.get(0).getAsJsonObject().getStringMember("kind")); assertEquals("de.x.Person", teFooArgsJson.get(0).getAsJsonObject().getStringMember("objName")); assertEquals("de.monticore.types.check.SymTypeConstant", teFooArgsJson.get(1).getAsJsonObject().getStringMember("kind")); assertEquals("double", teFooArgsJson.get(1).getAsJsonObject().getStringMember("constName")); assertEquals("de.monticore.types.check.SymTypeConstant", teFooArgsJson.get(2).getAsJsonObject().getStringMember("kind")); assertEquals("int", teFooArgsJson.get(2).getAsJsonObject().getStringMember("constName")); assertEquals("de.monticore.types.check.SymTypeOfObject", teFooArgsJson.get(3).getAsJsonObject().getStringMember("kind")); assertEquals("Human", teFooArgsJson.get(3).getAsJsonObject().getStringMember("objName")); result = JsonParser.parse(teDeep1.printAsJson()); assertTrue(result.isJsonObject()); JsonObject teDeep1Json = result.getAsJsonObject(); assertEquals("de.monticore.types.check.SymTypeOfGenerics", teDeep1Json.getStringMember("kind")); assertEquals("java.util.Set", teDeep1Json.getStringMember("typeConstructorFullName")); List<JsonElement> teDeep1ArgsJson = teDeep1Json.getArrayMember("arguments"); assertEquals(1, teDeep1ArgsJson.size(), 0.01); assertEquals("de.monticore.types.check.SymTypeOfGenerics", teDeep1ArgsJson.get(0).getAsJsonObject().getStringMember( "kind")); assertEquals("Map", teDeep1ArgsJson.get(0).getAsJsonObject().getStringMember( "typeConstructorFullName")); List<JsonElement> teDeep1teMapArgsJson = teDeep1ArgsJson.get(0).getAsJsonObject() .getArrayMember("arguments"); assertEquals(2, teDeep1teMapArgsJson.size(), 0.01); assertEquals("de.monticore.types.check.SymTypeConstant", teDeep1teMapArgsJson.get(0).getAsJsonObject().getStringMember( "kind")); assertEquals("int", teDeep1teMapArgsJson.get(0).getAsJsonObject().getStringMember("constName")); assertEquals("de.monticore.types.check.SymTypeOfObject", teDeep1teMapArgsJson.get(1).getAsJsonObject().getStringMember( "kind")); assertEquals("de.x.Person", teDeep1teMapArgsJson.get(1).getAsJsonObject().getStringMember( "objName")); result = JsonParser.parse(teDeep2.printAsJson()); assertTrue(result.isJsonObject()); JsonObject teDeep2Json = result.getAsJsonObject(); assertEquals("de.monticore.types.check.SymTypeOfGenerics", teDeep2Json.getStringMember("kind")); assertEquals("java.util.Map2", teDeep2Json.getStringMember("typeConstructorFullName")); List<JsonElement> teDeep2ArgsJson = teDeep2Json.getArrayMember("arguments"); assertEquals(2, teDeep2ArgsJson.size(), 0.01); assertEquals("de.monticore.types.check.SymTypeConstant", teDeep2ArgsJson.get(0).getAsJsonObject().getStringMember( "kind")); assertEquals("int", teDeep2ArgsJson.get(0).getAsJsonObject().getStringMember( "constName")); assertEquals("de.monticore.types.check.SymTypeOfGenerics", teDeep2ArgsJson.get(1).getAsJsonObject().getStringMember( "kind")); assertEquals("java.util.Set", teDeep2ArgsJson.get(1).getAsJsonObject().getStringMember( "typeConstructorFullName")); List<JsonElement> teDeep2SetArgsJson = teDeep2ArgsJson.get(1).getAsJsonObject() .getArrayMember("arguments"); assertEquals(1, teDeep2SetArgsJson.size(), 0.01); assertEquals("de.monticore.types.check.SymTypeOfGenerics", teDeep2SetArgsJson.get(0).getAsJsonObject().getStringMember( "kind")); assertEquals("Map", teDeep2SetArgsJson.get(0).getAsJsonObject().getStringMember( "typeConstructorFullName")); List<JsonElement> teDeep2SetMapArgsJson = teDeep2SetArgsJson.get(0).getAsJsonObject() .getArrayMember("arguments"); assertEquals(2, teDeep2SetMapArgsJson.size(), 0.01); assertEquals("de.monticore.types.check.SymTypeConstant", teDeep2SetMapArgsJson.get(0).getAsJsonObject().getStringMember( "kind")); assertEquals("int", teDeep2SetMapArgsJson.get(0).getAsJsonObject().getStringMember( "constName")); assertEquals("de.monticore.types.check.SymTypeOfObject", teDeep2SetMapArgsJson.get(1).getAsJsonObject().getStringMember( "kind")); assertEquals("de.x.Person", teDeep2SetMapArgsJson.get(1).getAsJsonObject().getStringMember( "objName")); result = JsonParser.parse(teUpperBound.printAsJson()); assertTrue(result.isJsonObject()); JsonObject teUpperBound2Json = result.getAsJsonObject(); assertEquals("de.monticore.types.check.SymTypeOfWildcard",teUpperBound2Json.getStringMember("kind")); assertTrue(teUpperBound2Json.getBooleanMember("isUpper")); JsonObject bound = teUpperBound2Json.getObjectMember("bound"); assertEquals("de.monticore.types.check.SymTypeConstant",bound.getStringMember("kind")); assertEquals("int",bound.getStringMember("constName")); }
protected abstract String printAsJson();
SymTypeExpression { protected abstract String printAsJson(); }
SymTypeExpression { protected abstract String printAsJson();  }
SymTypeExpression { protected abstract String printAsJson();  abstract String print(); boolean isTypeConstant(); boolean isGenericType(); boolean isTypeVariable(); boolean isArrayType(); boolean isVoidType(); boolean isNullType(); boolean isObjectType(); abstract SymTypeExpression deepClone(); abstract boolean deepEquals(SymTypeExpression sym); List<FunctionSymbol> getMethodList(String methodname); List<FunctionSymbol> getMethodList(String methodName, boolean outerIsType); List<VariableSymbol> getFieldList(String fieldName); List<VariableSymbol> getFieldList(String fieldName, boolean outerIsType); TypeSymbol getTypeInfo(); List<TypeSymbol> getInnerTypeList(String name); }
SymTypeExpression { protected abstract String printAsJson();  abstract String print(); boolean isTypeConstant(); boolean isGenericType(); boolean isTypeVariable(); boolean isArrayType(); boolean isVoidType(); boolean isNullType(); boolean isObjectType(); abstract SymTypeExpression deepClone(); abstract boolean deepEquals(SymTypeExpression sym); List<FunctionSymbol> getMethodList(String methodname); List<FunctionSymbol> getMethodList(String methodName, boolean outerIsType); List<VariableSymbol> getFieldList(String fieldName); List<VariableSymbol> getFieldList(String fieldName, boolean outerIsType); TypeSymbol getTypeInfo(); List<TypeSymbol> getInnerTypeList(String name);  }