Skip to content

Commit

Permalink
Generate SymTypeExpression DeSer attributes by default
Browse files Browse the repository at this point in the history
  • Loading branch information
luepges committed Nov 12, 2024
1 parent b805a34 commit 4a1ad67
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package de.monticore.codegen.cd2java._symboltable.serialization;

import de.monticore.generating.templateengine.HookPoint;
import de.monticore.types.check.SymTypeExpression;

import java.util.LinkedHashMap;
import java.util.Map;
Expand Down Expand Up @@ -49,6 +50,9 @@ public void init() {
bitsers.put("long", _long);
bitsers.put("java.lang.Long", _long);
bitsers.put("Long", _long);

BITSerStrategy symTypeExpression = new SymTypeExpressionSerStrategy();
bitsers.put(SymTypeExpression.class.getName(), symTypeExpression);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.codegen.cd2java._symboltable.serialization;

import de.monticore.generating.templateengine.HookPoint;
import de.monticore.generating.templateengine.StringHookPoint;
import de.monticore.types.check.SymTypeExpression;

/**
* DeSerialization of {@link SymTypeExpression} symbol attributes.
*/
public class SymTypeExpressionSerStrategy extends BITSerStrategy {
public SymTypeExpressionSerStrategy() {
super(SymTypeExpression.class.getName(), "null");
}

@Override
public HookPoint getSerialHook(String attrParam) {
return new StringHookPoint(String.format("de.monticore.types.check.SymTypeExpressionDeSer.serializeMember(s2j.getJsonPrinter(), \"%s\", %s);", attrParam, attrParam));
}

@Override
public HookPoint getOptSerialHook(String attrParam) {
return new StringHookPoint(String.format("de.monticore.types.check.SymTypeExpressionDeSer.serializeMember(s2j.getJsonPrinter(), \"%s\", %s);", attrParam, attrParam));
}

@Override
public HookPoint getListSerialHook(String attrParam) {
return new StringHookPoint(String.format("de.monticore.types.check.SymTypeExpressionDeSer.serializeMember(s2j.getJsonPrinter(), \"%s\", %s);", attrParam, attrParam));
}

public HookPoint getDeserialHook(String jsonParam, String attrParam) {
return new StringHookPoint(String.format("return de.monticore.types.check.SymTypeExpressionDeSer.deserializeMember(\"%s\", symbolJson, scope);", attrParam));
}

public HookPoint getOptDeserialHook(String jsonParam, String attrParam) {
return new StringHookPoint(String.format("return de.monticore.types.check.SymTypeExpressionDeSer.deserializeOptionalMember(\"%s\", symbolJson, scope);", attrParam));
}

public HookPoint getListDeserialHook(String jsonParam, String attrParam) {
return new StringHookPoint(String.format("return de.monticore.types.check.SymTypeExpressionDeSer.deserializeListMember(\"%s\", symbolJson, scope);", attrParam));
}
}

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 4a1ad67

Please sign in to comment.