• Post Reply Bookmark Topic Watch Topic
  • New Topic

cant extract a method  RSS feed

miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have this perfectly running code, but i'd like to refactor, extracting a method so that the code gets more readable
what the code does:
gets a string from a textfield and checks for its validity as an int
if the validation returns true i turn it into an int and use it to set some property:

the validation method:

so this is the code (except for last line) i'd like to refactor into a new method
the problem i'm facing is that, because "registo" is of primitive type i cant return a null, and xero or negative integers (int) wont be acceptable
any method i use should return an int, but - helas - no null for an int

is my idea feasable?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!