Skip to content

Commit

Permalink
Add a static TYPE variable to java models
Browse files Browse the repository at this point in the history
  • Loading branch information
RicoYao committed May 11, 2019
1 parent d467436 commit 47a9616
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/Core/JavaModelRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public struct JavaModelRenderer: JavaFileRenderer {
}
}

func renderStaticTypeString() -> JavaIR.Property {
return JavaIR.Property(annotations: [], modifiers: [.public, .static, .final], type: "String", name: "TYPE", initialValue: "\"" + className.lowercased() + "\"")
}

func renderModelHashCode() -> JavaIR.Method {
let bodyHashCode = transitiveProperties.map { param, _ in
Languages.java.snakeCaseToPropertyName(param)
Expand Down Expand Up @@ -73,7 +77,7 @@ public struct JavaModelRenderer: JavaFileRenderer {
index += 1
}

return [props, bitmasks, [bits]]
return [[renderStaticTypeString()], props, bitmasks, [bits]]
}

func propertyGetterForParam(param: String, schemaObj: SchemaObjectProperty) -> JavaIR.Method {
Expand Down

0 comments on commit 47a9616

Please sign in to comment.