This post demonstrates how to create static class members similar to that of Java. We use Kotlin 1.1 here
Groovy – @Sortable example
Groovy @Sortable is something similar to Java’s Comparable interface.
Kotlin – Overloading Constructors
This post demonstrates how to overload class constructors in Kotlin.
JPA – How to use @Embeddable and @Embedded
In Java Persistence API (JPA), a class can either be an @Entity or a value type. If a class is an @Entity, it is a persistent class. It represents a database table (or set of tables). If a class is a value type, it is not a persistent class. It may not represent a database table or a set of database tables. It may be used as a reusable component whose properties are used across multiple tables.
JPA – Optimistic Lock with @Version
In JPA, the use of @Version allows us to use Optimistic Locking wherein no real locks are actually applied to the database when updating records.
Kotlin – Compile and Run from Windows Command Line
This post demonstrates how to compile and run Kotlin from Windows Command Line. For Unix/Linux, it should be quite similar.
Kotlin – How to create Maven project for Kotlin
This post demonstrates how to create a Maven project for Kotlin as as library jar. Instead of a Java codes, we’ll only have Kotlin codes.
Kotlin – How to use your Kotlin library in Java Maven projects
This post demonstrates how to use a Maven dependency written in Kotlin in a Java Maven project.
Kotlin – Singleton
This post demonstrates how to create a Singleton object in Kotlin.
Should you use Mockito thenReturn or thenAnswer?
Should you use Mockito thenReturn or thenAnswer? It depends! The thenReturn returns the same value in every method run; while the thenAnswer does not. We use the former to return hard-coded values; while we use the latter for derived values.