scala.field.impl_ref.ssp Maven / Gradle / Ivy
The newest version!
<%
// Copyright 2013 Foursquare Labs Inc. All Rights Reserved.
import com.foursquare.spindle.codegen.runtime.{ScalaField, StructLike}
%>
<%@ val cls: StructLike %>
<%@ val field: ScalaField %>
// Field #${field.identifier} - ${field.name}
private var ${field.varName}: ${field.renderType.text} = ${field.renderType.defaultText} // Underlying type: ${field.renderType.underlying.text}
#if (field.defaultValueIsSet)
override def ${field.escapedName}: ${field.renderType.text} = ${field.name}OrDefault
#elseif (field.builderRequired)
override def ${field.escapedName}: ${field.renderType.text} = ${field.name}OrThrow
#end
override def ${field.escapedName}_=(x: ${field.renderType.text}): Unit = { ${field.varName} = x }
override def ${field.name}Option: Option[${field.renderType.text}] = if (${field.isSetName}) Some(${field.varName}) else None
#for (defaultValue <- field.defaultValueOption)
override def ${field.name}OrDefault: ${field.renderType.text} = if (${field.isSetName}) ${field.varName} else ${defaultValue}
#end
override def ${field.name}OrNull: ${field.renderType.text} = ${field.varName}
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.varName} != null
override def ${field.name}Unset(): Unit = { ${field.varName} = null }
#if (field.isForeignKey)
<% render("impl_fk.ssp", Map("field" -> field)) %>
#end
© 2015 - 2025 Weber Informatics LLC | Privacy Policy