@Test public void testHas() { Assert.assertTrue(put.has(FAMILY_01, QUALIFIER_01, TS, VALUE_01)); // Bad TS Assert.assertFalse(put.has(FAMILY_01, QUALIFIER_01, TS + 1, VALUE_01)); // Bad Value Assert.assertFalse(put.has(FAMILY_01, QUALIFIER_01, TS, QUALIFIER_01)); // Bad Family Assert.assertFalse(put.has(QUALIFIER_01, QUALIFIER_01, TS, VALUE_01)); // Bad Qual Assert.assertFalse(put.has(FAMILY_01, FAMILY_01, TS, VALUE_01)); } }
@Test public void testHas() { Assert.assertTrue(put.has(FAMILY_01, QUALIFIER_01, TS, VALUE_01)); // Bad TS Assert.assertFalse(put.has(FAMILY_01, QUALIFIER_01, TS + 1, VALUE_01)); // Bad Value Assert.assertFalse(put.has(FAMILY_01, QUALIFIER_01, TS, QUALIFIER_01)); // Bad Family Assert.assertFalse(put.has(QUALIFIER_01, QUALIFIER_01, TS, VALUE_01)); // Bad Qual Assert.assertFalse(put.has(FAMILY_01, FAMILY_01, TS, VALUE_01)); } }
/** * A convenience method to determine if this object's familyMap contains * a value assigned to the given family & qualifier. * Both given arguments must match the KeyValue object to return true. * * @param family column family * @param qualifier column qualifier * @return returns true if the given family and qualifier already has an * existing KeyValue object in the family map. */ public boolean has(byte [] family, byte [] qualifier) { return has(family, qualifier, this.ts, new byte[0], true, true); }
/** * A convenience method to determine if this object's familyMap contains * a value assigned to the given family & qualifier. * Both given arguments must match the KeyValue object to return true. * * @param family column family * @param qualifier column qualifier * @return returns true if the given family and qualifier already has an * existing KeyValue object in the family map. */ public boolean has(byte [] family, byte [] qualifier) { return has(family, qualifier, this.ts, new byte[0], true, true); }
/** * A convenience method to determine if this object's familyMap contains * a value assigned to the given family, qualifier and timestamp. * All 3 given arguments must match the KeyValue object to return true. * * @param family column family * @param qualifier column qualifier * @param value value to check * @return returns true if the given family, qualifier and value already has an * existing KeyValue object in the family map. */ public boolean has(byte [] family, byte [] qualifier, byte [] value) { return has(family, qualifier, this.ts, value, true, false); }
/** * A convenience method to determine if this object's familyMap contains * a value assigned to the given family, qualifier and timestamp. * All 3 given arguments must match the KeyValue object to return true. * * @param family column family * @param qualifier column qualifier * @param ts timestamp * @return returns true if the given family, qualifier and timestamp already has an * existing KeyValue object in the family map. */ public boolean has(byte [] family, byte [] qualifier, long ts) { return has(family, qualifier, ts, new byte[0], false, true); }
/** * A convenience method to determine if this object's familyMap contains * a value assigned to the given family, qualifier and timestamp. * All 3 given arguments must match the KeyValue object to return true. * * @param family column family * @param qualifier column qualifier * @param value value to check * @return returns true if the given family, qualifier and value already has an * existing KeyValue object in the family map. */ public boolean has(byte [] family, byte [] qualifier, byte [] value) { return has(family, qualifier, this.ts, value, true, false); }
/** * A convenience method to determine if this object's familyMap contains * a value assigned to the given family, qualifier and timestamp. * All 3 given arguments must match the KeyValue object to return true. * * @param family column family * @param qualifier column qualifier * @param ts timestamp * @return returns true if the given family, qualifier and timestamp already has an * existing KeyValue object in the family map. */ public boolean has(byte [] family, byte [] qualifier, long ts) { return has(family, qualifier, ts, new byte[0], false, true); }
/** * A convenience method to determine if this object's familyMap contains * the given value assigned to the given family, qualifier and timestamp. * All 4 given arguments must match the KeyValue object to return true. * * @param family column family * @param qualifier column qualifier * @param ts timestamp * @param value value to check * @return returns true if the given family, qualifier timestamp and value * already has an existing KeyValue object in the family map. */ public boolean has(byte [] family, byte [] qualifier, long ts, byte [] value) { return has(family, qualifier, ts, value, false, false); }
/** * A convenience method to determine if this object's familyMap contains * the given value assigned to the given family, qualifier and timestamp. * All 4 given arguments must match the KeyValue object to return true. * * @param family column family * @param qualifier column qualifier * @param ts timestamp * @param value value to check * @return returns true if the given family, qualifier timestamp and value * already has an existing KeyValue object in the family map. */ public boolean has(byte [] family, byte [] qualifier, long ts, byte [] value) { return has(family, qualifier, ts, value, false, false); }
protected byte[] findValue(byte[] family, byte[] qualifier, Put row) { if (!row.has(family, qualifier)) { return null; } List<Cell> cells = row.get(family, qualifier); Cell last = cells.get(cells.size() - 1); return CellUtil.cloneValue(last); }
protected byte[] fetchValue(byte[] family, byte[] qualifier, Put row) { if (!row.has(family, qualifier)) { throw new RequiredKeyFieldException("expected column qualifier '" + new String(qualifier) + "' for reference property, " + sourceProp); } List<Cell> cells = row.get(family, qualifier); Cell last = cells.get(cells.size() - 1); return CellUtil.cloneValue(last); }