Source:
<code>private String getGetterForVariable(String var, Class inputClassType) { try { final Field field = inputClassType.getField(var); if (Modifier.isPublic(field.getModifiers())) { return var; } logger.debug("Field is not publicly accessible. Proceeding to locate a getter method.", var); } catch (NoSuchFieldException ex) { logger.debug("{} does not have field {}. Proceeding to locate a getter method.", inputClassType.getName(), var); } catch (SecurityException ex) { logger.debug("{} does not have field {}. Proceeding to locate a getter method.", inputClassType.getName(), var); } String methodName = GET + var.substring(0, 1).toUpperCase() + var.substring(1); try { Method method = inputClassType.getMethod(methodName); if (Modifier.isPublic(method.getModifiers())) { return methodName + "()"; } logger.debug("Method of is not accessible. Proceeding to locate another getter method.", methodName, inputClassType.getName()); } catch (NoSuchMethodException ex) { logger.debug("{} does not have method {}. Proceeding to locate another getter method", inputClassType.getName(), methodName); } catch (SecurityException ex) { logger.debug("{} does not have method {}. Proceeding to locate another getter method", inputClassType.getName(), methodName); } methodName = IS + var.substring(0, 1).toUpperCase() + var.substring(1); try { Method method = inputClassType.getMethod(methodName); if (Modifier.isPublic(method.getModifiers())) { return methodName + "()"; } logger.debug("Method of is not accessible. Proceeding to locate another getter method.", methodName, inputClassType.getName()); } catch (NoSuchMethodException ex) { logger.debug("{} does not have method {}. Proceeding to locate another getter method", inputClassType.getName(), methodName); } catch (SecurityException ex) { logger.debug("{} does not have method {}. Proceeding to locate another getter method", inputClassType.getName(), methodName); } <START> return var; <END> }</code><technical_language>return error, if variable getter is in class</technical_language>

Target:
private String getGetterForVariable(String var, Class inputClassType) { try { final Field field = inputClassType.getField(var); if (Modifier.isPublic(field.getModifiers())) { return var; } logger.debug("Field is not publicly accessible. Proceeding to locate a getter method.", var); } catch (NoSuchFieldException | SecurityException ex) { logger.debug("{} does not have field {}. Proceeding to locate a getter method.", inputClassType.getName(), var); } String methodName = GET + var.substring(0, 1).toUpperCase() + var.substring(1); try { Method method = inputClassType.getMethod(methodName); if (Modifier.isPublic(method.getModifiers())) { return methodName + "()"; } logger.debug("Method of is not accessible. Proceeding to locate another getter method.", methodName, inputClassType.getName()); } catch (NoSuchMethodException | SecurityException ex) { logger.debug("{} does not have method {}. Proceeding to locate another getter method", inputClassType.getName(), methodName); } methodName = IS + var.substring(0, 1).toUpperCase() + var.substring(1); try { Method method = inputClassType.getMethod(methodName); if (Modifier.isPublic(method.getModifiers())) { return methodName + "()"; } logger.debug("Method of is not accessible. Proceeding to locate another getter method.", methodName, inputClassType.getName()); } catch (NoSuchMethodException | SecurityException ex) { logger.debug("{} does not have method {}. Proceeding to locate another getter method", inputClassType.getName(), methodName); } throw new IllegalArgumentException("Field '" + var + "' is not found in given class " + inputClassType.getName()); }