/** * A utility to build a GetOnlineRegionResponse. * * @param regions * @return the response */ public static GetOnlineRegionResponse buildGetOnlineRegionResponse( final List<HRegionInfo> regions) { GetOnlineRegionResponse.Builder builder = GetOnlineRegionResponse.newBuilder(); for (HRegionInfo region : regions) { builder.addRegionInfo(HRegionInfo.convert(region)); } return builder.build(); }
/** * Get the list of region info from a GetOnlineRegionResponse * * @param proto the GetOnlineRegionResponse * @return the list of region info */ public static List<HRegionInfo> getRegionInfos(final GetOnlineRegionResponse proto) { if (proto == null || proto.getRegionInfoCount() == 0) return null; return ProtobufUtil.getRegionInfos(proto); }