Search in sources :

Example 1 with JsonField

use of jadx.core.codegen.json.cls.JsonField in project jadx by skylot.

the class JsonCodeGen method addFields.

private void addFields(ClassNode cls, JsonClass jsonCls, ClassGen classGen) {
    jsonCls.setFields(new ArrayList<>());
    for (FieldNode field : cls.getFields()) {
        if (field.contains(AFlag.DONT_GENERATE)) {
            continue;
        }
        JsonField jsonField = new JsonField();
        jsonField.setName(field.getName());
        if (field.getFieldInfo().hasAlias()) {
            jsonField.setAlias(field.getAlias());
        }
        ICodeWriter cw = new SimpleCodeWriter();
        classGen.addField(cw, field);
        jsonField.setDeclaration(cw.getCodeStr());
        jsonField.setAccessFlags(field.getAccessFlags().rawValue());
        jsonCls.getFields().add(jsonField);
    }
}
Also used : JsonField(jadx.core.codegen.json.cls.JsonField) FieldNode(jadx.core.dex.nodes.FieldNode) SimpleCodeWriter(jadx.api.impl.SimpleCodeWriter) ICodeWriter(jadx.api.ICodeWriter)

Aggregations

ICodeWriter (jadx.api.ICodeWriter)1 SimpleCodeWriter (jadx.api.impl.SimpleCodeWriter)1 JsonField (jadx.core.codegen.json.cls.JsonField)1 FieldNode (jadx.core.dex.nodes.FieldNode)1