Add pattern to java part