-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce an early Java type translator
Rel #30
- Loading branch information
Showing
3 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package jabsc; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.function.Function; | ||
|
||
/** | ||
* Some ABS types have an equivalent proper Java type. This is | ||
* function to be able to translate those. | ||
*/ | ||
public class JavaTypeTranslator implements Function<String, String> { | ||
|
||
private final Map<String, String> abs2java = new HashMap<>(); | ||
|
||
public JavaTypeTranslator() { | ||
fill(abs2java); | ||
} | ||
|
||
@Override | ||
public String apply(String absType) { | ||
String javaType = abs2java.get(absType); | ||
if (javaType != null) { | ||
return javaType; | ||
} | ||
// TODO To be completed. | ||
return absType; | ||
} | ||
|
||
protected void fill(Map<String, String> types) { | ||
types.put("Int", Integer.class.getName()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters