use of com.fasterxml.jackson.annotation.JsonAlias in project ddf-common by dongfangding.
the class JacksonAnnotationIntrospector method findPropertyAliases.
@Override
public List<PropertyName> findPropertyAliases(Annotated m) {
JsonAlias ann = _findAnnotation(m, JsonAlias.class);
if (ann == null) {
return null;
}
String[] strs = ann.value();
final int len = strs.length;
if (len == 0) {
return Collections.emptyList();
}
List<PropertyName> result = new ArrayList<>(len);
for (int i = 0; i < len; ++i) {
result.add(PropertyName.construct(strs[i]));
}
return result;
}
use of com.fasterxml.jackson.annotation.JsonAlias in project DJI-Cloud-API-Demo by dji-sdk.
the class CustomClaim method convertToMap.
/**
* Convert the custom claim data type to the Map type.
* @return map
*/
public ConcurrentHashMap<String, String> convertToMap() {
ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>(4);
try {
Field[] declaredFields = this.getClass().getDeclaredFields();
for (Field field : declaredFields) {
JsonAlias annotation = field.getAnnotation(JsonAlias.class);
field.setAccessible(true);
// The value of key is named underscore.
map.put(annotation != null ? annotation.value()[0] : field.getName(), field.get(this).toString());
}
} catch (IllegalAccessException e) {
log.info("CustomClaim converts failed. {}", this.toString());
e.printStackTrace();
}
return map;
}
Aggregations