コード例 #1
0
 private void addVarArgsWither(
     Filter filter, JMethod wither, JDefinedClass bldrCls, JClass paramType)
     throws JClassAlreadyExistsException {
   JMethod method = bldrCls.method(wither.mods().getValue(), wither.type(), wither.name());
   if (filter.getTitle() != null) {
     method.javadoc().add(String.format("<p>%s</p>", filter.getTitle()));
   }
   JVar param = method.varParam(paramType, wither.listParams()[0].name());
   method
       .body()
       ._return(JExpr.invoke(wither).arg(immutableList.staticInvoke("copyOf").arg(param)));
 }
コード例 #2
0
 private void generateSingularPropertyAccessor(final DefinedPropertyOutline fieldOutline) {
   final JFieldVar fieldVar = fieldOutline.getFieldVar();
   if (fieldVar != null) {
     final JMethod modifier =
         this.modifierClass.method(
             JMod.PUBLIC,
             this.modifierClass.owner().VOID,
             ModifierGenerator.SETTER_PREFIX + fieldOutline.getBaseName());
     final JVar parameter =
         modifier.param(JMod.FINAL, fieldVar.type(), fieldOutline.getFieldName());
     if (this.implement) {
       modifier
           .body()
           .add(
               new NestedThisRef(this.classOutline.getImplClass())
                   .invoke(modifier.name())
                   .arg(parameter));
     }
   }
 }