My journey to defeat the evil boiler-plate code

Epic journey background
  • Update the controller with the new entity. Clean not relevant code.
  • Update the service with the new entity, again. Clean not relevant code.
  • Update the handler with the new entity, again… Clean not relevant code.
  • Update the DAO with the new entity, again……. Clean not relevant code.
Lots and lots of boiler-plate code
@Entity
@Table(name = "example")
@DefaultMappingTarget(ExampleDisplay::class)
class Example(
@MappedField
@Column
var exampleString: String?,
@MappedField
@Column
var exampleBoolean: Boolean?,
// ...) : AbstractJpaEntity()@DefaultMappingTarget(Example::class)
data class ExampleDisplay(
@MappedField
var exampleString: String? = null,
@MappedField
var exampleBoolean: Boolean? = null,
// ...) : AbstractJpaDisplay()@RestController
@RequestMapping("example")
class ExampleController : BaseCRUDController<Example, ExampleDisplay>() {
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store