scala.field.impl_primitive.ssp Maven / Gradle / Ivy
The newest version!
<%
// Copyright 2013 Foursquare Labs Inc. All Rights Reserved.
import com.foursquare.spindle.codegen.runtime.{RenderType, ScalaField, StructLike}
%>
<%@ val cls: StructLike %>
<%@ val field: ScalaField %>
<%@ val renderType: RenderType = field.renderType %>
// Field #${field.identifier} - ${field.name}
private var ${field.varName}: ${renderType.text} = ${renderType.defaultText} // Underlying type: ${renderType.underlying.text}
private var ${field.isSetVar}: Boolean = false
override def ${field.escapedName}: ${renderType.text} = ${field.name}OrDefault
override def ${field.escapedName}_=(x: ${renderType.text}): Unit = { ${field.varName} = x ; ${field.isSetVar} = true }
override def ${field.name}Option: Option[${renderType.text}] = if (${field.isSetName}) Some(${field.varName}) else None
override def ${field.name}OrDefault: ${renderType.text} = ${field.varName}
override def ${field.name}OrNull: ${field.renderType.boxedText} = if (${field.isSetName}) ${field.varName} else null
override def ${field.name}OrThrow: ${field.renderType.text} = if (${field.isSetName}) ${field.varName} else throw new java.lang.NullPointerException("field ${field.escapedName} of ${cls.name} missing")
override def ${field.isSetName}: Boolean = ${field.isSetVar}
override def ${field.name}Unset(): Unit = { ${field.isSetVar} = false; ${field.varName} = ${renderType.defaultText} }
#if (field.isForeignKey)
<% render("impl_fk.ssp", Map("field" -> field)) %>
#end
© 2015 - 2025 Weber Informatics LLC | Privacy Policy