Skip to content

Commit

Permalink
complete2
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Kovetskiy authored and Alex Kovetskiy committed Feb 18, 2017
1 parent 2c0b3ed commit fbbe2da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public interface DataMapper {

Map convertToMap(Object value);

<T> T convert(Map map, Class<T> dataType);
<T> T convert(Map<String, Object> map, Class<T> dataType);

//<T> T convert(HashMap map, Class<T> dataType);
<T> T convert(Map<String, Object> map, TypeReference<T> dataType);

<T> T mapData(String data, Class<T> dataType);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.softgroup.common.exceptions.MapperException;

import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;

/**
Expand Down Expand Up @@ -43,17 +44,17 @@ public Map convertToMap(final Object value) {
}
}

// @Override
// public convert(map, dataType) {
// try {
// return mapper.convertValue(map, dataType);
// } catch (Exception ex) {
// throw new MapperException("Can't convert map ", ex);
// }
// }
@Override
public <T> T convert(Map<String, Object> map, Class<T> dataType) {
try {
return mapper.convertValue(map, dataType);
} catch (Exception ex) {
throw new MapperException("Can't convert map ", ex);
}
}

@Override
public <T> T convert(Map map, Class<T> dataType) {
public <T> T convert(Map<String, Object> map, TypeReference<T> dataType) {
try {
return mapper.convertValue(map, dataType);
} catch (Exception ex) {
Expand Down

0 comments on commit fbbe2da

Please sign in to comment.