cv.visitInsn(IRETURN);
cv.visitMaxs(1, 1);
}
}
private void generateGetClassProperties(HomeContext gc) throws SpeedoException {
CodeVisitor cv = gc.cv.visitMethod(ACC_PUBLIC + ACC_FINAL, "getClassProperties",
"()Ljava/util/Properties;", null, null);
cv.visitTypeInsn(NEW, "java/util/Properties");
cv.visitInsn(DUP);
cv.visitMethodInsn(INVOKESPECIAL, "java/util/Properties", "<init>", "()V");
cv.visitVarInsn(ASTORE, 1);
Properties classProperties = new Properties();
getJormConfig(gc.sc, classProperties);
String xmlFileName = gc.sc.moPackage.xmlDescriptor.xmlFile;
xmlFileName = StringReplace.replaceChar('/', '.', xmlFileName);
xmlFileName = StringReplace.replaceChar(fs, '.', xmlFileName);
classProperties.setProperty(
Object2StringSerializer.DESC_FILE_NAME_PROP,
xmlFileName);
for (Iterator it = classProperties.entrySet().iterator(); it.hasNext();) {
Map.Entry me = (Map.Entry) it.next();
cv.visitVarInsn(ALOAD, 1);
cv.visitLdcInsn(me.getKey());
cv.visitLdcInsn(me.getValue());
cv.visitMethodInsn(INVOKEVIRTUAL, "java/util/Properties", "setProperty",
"(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;");
cv.visitInsn(POP); //remove the result of the setProperty method
}
cv.visitVarInsn(ALOAD, 1);
cv.visitInsn(ARETURN);
cv.visitMaxs(3, 2);
}