Skip to content

Commit

Permalink
make lint, make format
Browse files Browse the repository at this point in the history
  • Loading branch information
RicoYao committed Mar 11, 2019
1 parent 99e30f9 commit 9659f11
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Sources/Core/JavaModelRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,34 +75,34 @@ public struct JavaModelRenderer: JavaFileRenderer {

return [props, bitmasks, [bits]]
}

func propertyGetterForParam(param: String, schemaObj: SchemaObjectProperty) -> JavaIR.Method {
// For Booleans, Integers and Doubles, make the getter method @NonNull and squash to a default value if necessary.
// This makes callers less susceptible to null pointer exceptions.
switch schemaObj.schema {
case .boolean:
return JavaIR.method( [.public], "@NonNull Boolean get" + param.snakeCaseToCapitalizedPropertyName() + "()") { [
return JavaIR.method([.public], "@NonNull Boolean get" + param.snakeCaseToCapitalizedPropertyName() + "()") { [
"return this." + param.snakeCaseToPropertyName() + " == null ? Boolean.FALSE : this." + param.snakeCaseToPropertyName() + ";",
]
]
}
case .integer:
return JavaIR.method([.public], "@NonNull Integer get" + param.snakeCaseToCapitalizedPropertyName() + "()") { [
"return this." + param.snakeCaseToPropertyName() + " == null ? 0 : this." + param.snakeCaseToPropertyName() + ";",
]
]
}
case .float:
return JavaIR.method([.public], "@NonNull Double get" + param.snakeCaseToCapitalizedPropertyName() + "()") { [
"return this." + param.snakeCaseToPropertyName() + " == null ? 0 : this." + param.snakeCaseToPropertyName() + ";",
]
]
}
default:
return JavaIR.method([.public], self.typeFromSchema(param, schemaObj) + " get" + param.snakeCaseToCapitalizedPropertyName() + "()") { [
return JavaIR.method([.public], typeFromSchema(param, schemaObj) + " get" + param.snakeCaseToCapitalizedPropertyName() + "()") { [
"return this." + param.snakeCaseToPropertyName() + ";",
]
]
}
}
}

func renderModelPropertyGetters() -> [JavaIR.Method] {
let getters = transitiveProperties.map { param, schemaObj in
propertyGetterForParam(param: param, schemaObj: schemaObj)
Expand Down

0 comments on commit 9659f11

Please sign in to comment.