SpanUtil { public static RowColumn toRowColumn(Key key) { if (key == null) { return RowColumn.EMPTY; } if ((key.getRow() == null) || key.getRow().getLength() == 0) { return RowColumn.EMPTY; } Bytes row = ByteUtil.toBytes(key.getRow()); if ((key.getColumnFamily() == null) || key.getColumnFamily().getLength() == 0) { return new RowColumn(row); } Bytes cf = ByteUtil.toBytes(key.getColumnFamily()); if ((key.getColumnQualifier() == null) || key.getColumnQualifier().getLength() == 0) { return new RowColumn(row, new Column(cf)); } Bytes cq = ByteUtil.toBytes(key.getColumnQualifier()); if ((key.getColumnVisibility() == null) || key.getColumnVisibility().getLength() == 0) { return new RowColumn(row, new Column(cf, cq)); } Bytes cv = ByteUtil.toBytes(key.getColumnVisibility()); return new RowColumn(row, new Column(cf, cq, cv)); } private  SpanUtil(); static Range toRange(Span span); static Key toKey(RowColumn rc); static Span toSpan(Range range); static RowColumn toRowColumn(Key key);  }
@Test public void testToRowColumn() { Assert.assertEquals(RowColumn.EMPTY, SpanUtil.toRowColumn(null)); Assert.assertEquals(new RowColumn("row"), SpanUtil.toRowColumn(new Key("row"))); Assert.assertEquals(new RowColumn("row", new Column("cf")), SpanUtil.toRowColumn(new Key("row", "cf"))); Assert.assertEquals(new RowColumn("row", new Column("cf", "cq")), SpanUtil.toRowColumn(new Key("row", "cf", "cq"))); Assert.assertEquals(new RowColumn("row", new Column("cf", "cq", "cv")), SpanUtil.toRowColumn(new Key("row", "cf", "cq", "cv"))); }