/** {@inheritDoc} */ @Override public boolean hasField(Object obj, String fieldName) { return obj != null && ((BinaryObject)obj).hasField(fieldName); }
/** * @throws Exception If failed. */ @Test public void testBinaryObject() throws Exception { BinaryMarshaller marsh = binaryMarshaller(Arrays.asList(new BinaryTypeConfiguration(SimpleObject.class.getName()))); SimpleObject obj = simpleObject(); BinaryObject po = marshal(obj, marsh); BinaryObject po0 = marshalUnmarshal(po, marsh); assertTrue(po.hasField("b")); assertTrue(po.hasField("s")); assertTrue(po.hasField("i")); assertTrue(po.hasField("l")); assertTrue(po.hasField("f")); assertTrue(po.hasField("d")); assertTrue(po.hasField("c")); assertTrue(po.hasField("bool")); assertFalse(po.hasField("no_such_field")); assertEquals(obj, po.deserialize()); assertEquals(obj, po0.deserialize()); }
/** {@inheritDoc} */ @Override public boolean hasField(Object obj, String fieldName) { return obj != null && ((BinaryObject)obj).hasField(fieldName); }
@Override public List<String> call() throws Exception { List<String> names = new ArrayList<>(); IgniteCache<BinaryObject, BinaryObject> personCache = currentIgniteInstance .cache("SQL_PUBLIC_PERSON").withKeepBinary(); IgniteBiPredicate<BinaryObject, BinaryObject> filter = (BinaryObject key, BinaryObject value) -> { return key.hasField("CITY_ID") && key.<Long>field("CITY_ID") == cityId; }; ScanQuery<BinaryObject, BinaryObject> query = new ScanQuery<>(filter); try (QueryCursor<Entry<BinaryObject, BinaryObject>> cursor = personCache.query(query)) { Iterator<Entry<BinaryObject, BinaryObject>> itr = cursor.iterator(); while (itr.hasNext()) { Entry<BinaryObject, BinaryObject> cache = itr.next(); names.add(cache.getValue().<String>field("NAME")); } } return names; } }).forEach(System.out::println);