Skip to content

Commit

Permalink
skipping same type conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeroen van Schagen committed Aug 24, 2015
1 parent b657927 commit 520cf41
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/io/beanmapper/BeanMapperConverterAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public Set<ConvertiblePair> getConvertibleTypes() {
*/
@Override
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
// Skip converting between the same types
if (sourceType.getType().equals(targetType.getType())) {
return source;
}
return beanMapper.map(source, targetType.getType());
}

Expand Down

1 comment on commit 520cf41

@robert-bor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work for collections?

Please sign in to comment.