LalithMaringanti opened a new pull request, #130: URL: https://github.com/apache/commons-validator/pull/130
Refactoring technique: Push down method Class/method: org.apache.commons.validator.routines.AbstractNumberValidator.determineScale() Description: AbstractNumberValidator class has a method named as determineScale() which is used only once in another method of the child class of AbstractNumberValidator which is BigDecimalValidator class. Therefore, removed determineScale() method from the parent class AbstractNumberValidator and placed it in the child class BigDecimalValidator class. This is done to increase cohesiveness and code readability. Refactoring technique: Extract class Class/Method: org.apache.commons.validator.ValidatorAction Description: ValidatorAction consists of methods such as isValid(), handleIndexedField(), getValidationClassInstance() along with methods which are related to validation of only javascript file/functions. For instance readJavaScriptFile(), javaScriptAlreadyLoaded(), formatJavaScriptFileName() etc. Removed all these methods and placed them in a newly created class ValidatorActionUtils to make ValidatorAction more cohesive. Refactoring technique: Replace conditional with polymorphism Class/Method: org.apache.commons.validator.ValidatorResources.getParent() Description: removed if else conditional statements and created abstract class FormSetHierarchy which consists of abstract method getParent which returns FormSet object. For each if condition, a new class is created which extends the FormSetHierarchy class and implements different getParent method. Refactoring technique: Extract Method Class/Method: org.apache.commons.validator.routines.DomainValidator.unicodeToASCII() Description: Extracted all the statements which converts given input string to ascii string and created a new method called toAsciiCode() method and statements responsible for adding trailing dots are moved into addTrailingDotIfMissing() method -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
