Skip to content
This repository has been archived by the owner on Nov 24, 2020. It is now read-only.

Commit

Permalink
Merge pull request #60 from yagolasse/master
Browse files Browse the repository at this point in the history
feat: Added money type as Long to Java target
  • Loading branch information
dgadelha authored Dec 11, 2019
2 parents 89e9975 + 4285860 commit a1c3bcd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/target/java.cr
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ abstract class JavaTarget < Target
when AST::StringPrimitiveType ; "String"
when AST::IntPrimitiveType ; "Integer"
when AST::UIntPrimitiveType ; "Integer"
when AST::MoneyPrimitiveType ; "Long"
when AST::FloatPrimitiveType ; "Double"
when AST::DatePrimitiveType ; "Calendar"
when AST::DateTimePrimitiveType; "Calendar"
Expand Down Expand Up @@ -201,6 +202,8 @@ END

def type_from_json(t : AST::Type, obj : String, name : String)
case t
when AST::MoneyPrimitiveType
"#{obj}.getLong(#{name})"
when AST::StringPrimitiveType
"#{obj}.getString(#{name})"
when AST::IntPrimitiveType, AST::UIntPrimitiveType
Expand Down Expand Up @@ -236,7 +239,7 @@ END

def type_to_json(t : AST::Type, src : String)
case t
when AST::StringPrimitiveType, AST::IntPrimitiveType, AST::UIntPrimitiveType, AST::FloatPrimitiveType, AST::BoolPrimitiveType
when AST::StringPrimitiveType, AST::IntPrimitiveType, AST::UIntPrimitiveType, AST::FloatPrimitiveType, AST::BoolPrimitiveType, AST::MoneyPrimitiveType
"#{src}"
when AST::DatePrimitiveType
"DateHelpers.encodeDate(#{src})"
Expand Down

0 comments on commit a1c3bcd

Please sign in to comment.