use of com.ctrip.framework.apollo.openapi.dto.OpenNamespaceDTO in project apollo by ctripcorp.
the class OpenApiBeanUtils method transformFromNamespaceBO.
public static OpenNamespaceDTO transformFromNamespaceBO(NamespaceBO namespaceBO) {
Preconditions.checkArgument(namespaceBO != null);
OpenNamespaceDTO openNamespaceDTO = BeanUtils.transfrom(OpenNamespaceDTO.class, namespaceBO.getBaseInfo());
// app namespace info
openNamespaceDTO.setFormat(namespaceBO.getFormat());
openNamespaceDTO.setComment(namespaceBO.getComment());
openNamespaceDTO.setPublic(namespaceBO.isPublic());
// items
List<OpenItemDTO> items = new LinkedList<>();
List<ItemBO> itemBOs = namespaceBO.getItems();
if (!CollectionUtils.isEmpty(itemBOs)) {
items.addAll(itemBOs.stream().map(itemBO -> transformFromItemDTO(itemBO.getItem())).collect(Collectors.toList()));
}
openNamespaceDTO.setItems(items);
return openNamespaceDTO;
}
Aggregations