Created
May 23, 2013 10:20
-
-
Save arialdomartini/5635127 to your computer and use it in GitHub Desktop.
Ti insospettisce questo refactoring?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Before | |
public JavaAdvertSchedule GetByWebSite(String website, String checkableFromDay) { | |
ObjectIterator<JavaAdvertSchedule> result = null; | |
try { | |
result = new ObjectIterator<JavaAdvertSchedule>("JE.AdvertLifecycle.Scheduling.Data.JavaAdvertSchedule", "JavaAdvertSchedule_GetByWebsite", website, checkableFromDay); | |
if (As.Boolean(result.HasNext())) { | |
return result.GetNext(); | |
} | |
return null; | |
} finally { | |
if (result != null) result.close(); | |
} | |
} | |
// After | |
public JavaAdvertSchedule GetByWebSite(String website, String checkableFromDay) { | |
ObjectIterator<JavaAdvertSchedule> result = new ObjectIterator<JavaAdvertSchedule>("JE.AdvertLifecycle.Scheduling.Data.JavaAdvertSchedule", "JavaAdvertSchedule_GetByWebsite", website, checkableFromDay); | |
if (!As.Boolean(result.HasNext())) { | |
return null; | |
} | |
JavaAdvertSchedule record = result.GetNext(); | |
result.close(); | |
return record; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment