@Override public Result execute(UIExecutionContext context) throws Exception { JavaResource javaResource = targetClass.getValue(); JavaClassSource targetClass = javaResource.getJavaType(); GetSetMethodGenerator generator; if (builderPattern.getValue()) { generator = new BuilderGetSetMethodGenerator(); } else { generator = new DefaultGetSetMethodGenerator(); } List<PropertySource<JavaClassSource>> selectedProperties = new ArrayList<>(); if (properties == null || properties.getValue() == null) { return Results.fail("No properties were selected"); } for (String selectedProperty : properties.getValue()) { selectedProperties.add(targetClass.getProperty(selectedProperty)); } for (PropertySource<JavaClassSource> property : selectedProperties) { MethodSource<JavaClassSource> accessor = targetClass.getMethod("get" + Strings.capitalize(property.getName())); if (accessor == null) { generator.createAccessor(property); } else { if (!generator.isCorrectAccessor(accessor, property)) { if (promptToFixMethod(context, accessor.getName(), property.getName())) { targetClass.removeMethod(accessor); generator.createMutator(property); } } } String mutatorMethodName = "set" + Strings.capitalize(property.getName()); String mutatorMethodParameter = property.getType().getName(); MethodSource<JavaClassSource> mutator = targetClass.getMethod(mutatorMethodName, mutatorMethodParameter); if (mutator == null) { generator.createMutator(property); } else { if (!generator.isCorrectMutator(mutator, property)) { if (promptToFixMethod(context, mutator.getName(), property.getName())) { targetClass.removeMethod(mutator); generator.createMutator(property); } } } } setCurrentWorkingResource(context, targetClass); return Results.success("Mutators and accessors were generated successfully"); }