case class AppleHash(hash: UUID, uuid: UUID) object AppleHash { def builder = new Builder class Builder { private var hash: UUID = _ private var uuid: UUID = _ def hash(hash: UUID): Builder = {this.hash = hash; this } def uuid(uuid: UUID): Builder = {this.uuid = uuid; this } def build = AppleHash(hash = hash, uuid = uuid) } } // Java side package com.vertigo.dp; import java.util.UUID; /** A {@code TestB} is an object that... */ public class TestB { public static void main(String[] args) { UUID hash = UUID.randomUUID(); UUID uuid = UUID.randomUUID(); AppleHash ah = AppleHash.builder() .hash(hash) .uuid(uuid) .build(); System.out.println("ah = " + ah); } }