Pattern builder for Java