DATAMONGO-1372 - Polishing.
Tiny formattings, collapsed if-clause into ternary operation. Original pull request: #342.
This commit is contained in:
@@ -267,6 +267,7 @@ abstract class MongoConverters {
|
||||
*/
|
||||
@WritingConverter
|
||||
public static enum CurrencyToStringConverter implements Converter<Currency, String> {
|
||||
|
||||
INSTANCE;
|
||||
|
||||
/*
|
||||
@@ -275,12 +276,7 @@ abstract class MongoConverters {
|
||||
*/
|
||||
@Override
|
||||
public String convert(Currency source) {
|
||||
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return source.getCurrencyCode();
|
||||
return source == null ? null : source.getCurrencyCode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,6 +288,7 @@ abstract class MongoConverters {
|
||||
*/
|
||||
@ReadingConverter
|
||||
public static enum StringToCurrencyConverter implements Converter<String, Currency> {
|
||||
|
||||
INSTANCE;
|
||||
|
||||
/*
|
||||
@@ -300,12 +297,7 @@ abstract class MongoConverters {
|
||||
*/
|
||||
@Override
|
||||
public Currency convert(String source) {
|
||||
|
||||
if (!StringUtils.hasText(source)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Currency.getInstance(source);
|
||||
return StringUtils.hasText(source) ? Currency.getInstance(source) : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2016 by the original author(s).
|
||||
* Copyright 2011-2016 by the original author(s).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
Reference in New Issue
Block a user