orika-mapper / orika

Simpler, better and faster Java bean mapping framework
http://orika-mapper.github.io/orika-docs/
Apache License 2.0
1.29k stars 268 forks source link

Performed refactoring techniques to make the code more clear #388

Open Rutvik-09 opened 2 years ago

Rutvik-09 commented 2 years ago

The following refactoring techniques were applied:

  1. Rename the variable: The file "Mapping Context.java" had a boolean variable called isNew and it has been changed to isNewConcreteClass due to behavior and usage of that variable for knowing whether the concrete class has been introduced or not.
  2. Extract Method: The file " ScoringClassMapBuilder.java" had a code of block, which was converted into a method named "getUnmatchedFields()" to specify which fields will be mapped and the remaining ones will be unmatched, which gets returned by the mentioned function.
  3. Move Method: A new class called "ElementTypeClass.java" was created, which had the method called "defaultElementType()" and was moved to the given class due to its implementation from the original class called "Property.java" and later called in this class.
  4. Push-Down Method: A method named "List asList(Object[] iterable)" was pushed down from a class called "GeneratedObjectBase.java" to a class called "GeneratedObjectFactory" as to it belonged more to the former one due to its functionality.
  5. Pull-Up Method: The changes were made to three inter-related interfaces having a superclass and subclass relationship. The method called "void setMapperFactory()" was moved into the interface called "BaseSpecificition.java", which was implemented by the two interfaces called "Specification.java" and "AggregateSpecification.java".