New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the way accessor method names are determined for the fields of an entity #96

Closed
sai-pullabhotla opened this Issue Dec 13, 2016 · 1 comment

Comments

Projects
None yet
1 participant
@sai-pullabhotla
Copy link
Owner

sai-pullabhotla commented Dec 13, 2016

Currently, the accessor methods for a field are determined with -

	"set" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1);
	"get" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1);
	"is" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1);

While this works in most cases, there are some situations where this does not work right/not compatible with IDE's generated setter and getter methods. For example, if a field name is iPhone, the IDEs generate setiPhone and getiPhone methods. Note the small i in the method names. The code above instead looks for setIPhone and getIPhone and ends up not finding the methods.

The fix is to examine the second character of the field name, if it is upper case, do not do anything and use the field name as is and prepend set/get/is. Otherwise, fallback to the existing code.

See #95 for more details.

@sai-pullabhotla

This comment has been minimized.

Copy link
Owner Author

sai-pullabhotla commented Dec 14, 2016

Fixed and added test cases.

@sai-pullabhotla sai-pullabhotla added this to the 1.1.3 milestone Dec 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment