/** * Find the getter of the specified property in the type. * @param clazz The class. * @param property The property. * @return The getter method if found. Throws exception if no getter is matched. */ public static Method find(TypeDef clazz, Property property) { return find(clazz, property, false); }
Method getter = Getter.find(clazz, property); if (getter != null) { String cast = property.getTypeRef() instanceof TypeParamRef ? "(" + property.getTypeRef().toString() + ")" : ""; if (!hasBuildableConstructorWithArgument(target, property) && Setter.has(target, property)) { String withName = "with" + property.getNameCapitalized(); String getterName = Getter.find(target, property).getName(); statements.add(new StringStatement(new StringBuilder().append(ref).append(".").append(withName).append("(instance.").append(getterName).append("());\n").toString()));
.append("new ").append(generatedType.getName()).append("(") .append(ctor.getArguments().stream() .map(p -> Getter.find(((ClassRef) m.getReturnType()).getDefinition(), p, true)) .map(g -> g.getName()) .map(s -> "i."+s+"()").collect(Collectors.joining(", "))) .append("new ").append(generatedType.getName()).append("(") .append(ctor.getArguments().stream() .map(p -> Getter.find(((ClassRef) m.getReturnType()).getDefinition(), p, true)) .map(g -> g.getName()) .map(s -> "instance."+m.getName()+"()."+s+"()").collect(Collectors.joining(", ")))