public void generateQuery(Feed feed) { try { JClass transformedType = getTransformedType(feed); if (transformedType == null) { return; } JDefinedClass cls = pkg._class(JMod.PUBLIC | JMod.FINAL, String.format("%sQuery", feed.getName())); cls._extends(parent.narrow(transformedType)); if (feed.getTitle() != null) { cls.javadoc().add(String.format("<p>%s</p>", feed.getTitle())); } addResourcePath(cls, feed); addResultTypeMethod(model, cls, transformedType); addConstructor(cls); JDefinedClass bldrCls = addBuilderCls(feed, cls); cls.method(JMod.PUBLIC | JMod.STATIC | JMod.FINAL, bldrCls, "builder") .body() ._return(JExpr._new(bldrCls)); JMethod cpyMthd = cls.method(JMod.PROTECTED | JMod.FINAL, cls, "copy"); JVar cpyParam = cpyMthd.param(immutableMap.narrow(String.class, Object.class), "params"); cpyMthd.body()._return(JExpr._new(cls).arg(cpyParam)); } catch (Exception e) { throw new IllegalStateException(e); } }