Simplified access of getSimpleName (#1042)

* Simplified access of getSimpleName

instead of calling getClass.getSimpleName() that will check too many conditions inside , we can make it as final String and use it directly.

* Simplified access of getSimpleName

making string as static

* Simplified access of getSimpleName

Code Review changes
This commit is contained in:
sourabh gupta 2017-03-21 02:55:52 +05:30 committed by inder123
parent 3063136a2c
commit 441fa98735
1 changed files with 5 additions and 3 deletions

View File

@ -37,10 +37,12 @@ import com.google.gson.internal.bind.util.ISO8601Utils;
final class DefaultDateTypeAdapter implements JsonSerializer<Date>, JsonDeserializer<Date> {
// TODO: migrate to streaming adapter
private static final String SIMPLE_NAME = "DefaultDateTypeAdapter";
private final DateFormat enUsFormat;
private final DateFormat localFormat;
DefaultDateTypeAdapter() {
this(DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.US),
DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT));
@ -111,7 +113,7 @@ final class DefaultDateTypeAdapter implements JsonSerializer<Date>, JsonDeserial
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(DefaultDateTypeAdapter.class.getSimpleName());
sb.append(SIMPLE_NAME);
sb.append('(').append(localFormat.getClass().getSimpleName()).append(')');
return sb.toString();
}