@Override @SuppressWarnings("unchecked") void importPlain(ImportContext context, Object obj, ObjId id) { // Get POJO map final Map<?, ?> objMap; try { objMap = (Map<?, ?>)obj.getClass().getMethod(this.getter.getName()).invoke(obj); } catch (Exception e) { return; } if (objMap == null) return; // Get core API map final Map<Object, Object> coreMap = (Map<Object, Object>)context.getTransaction().getTransaction().readMapField( id, this.storageId, true); // Copy key/value pairs over coreMap.clear(); for (Map.Entry<?, ?> entry : objMap.entrySet()) { coreMap.put( this.keyField.importCoreValue(context, entry.getKey()), this.valueField.importCoreValue(context, entry.getValue())); } }
@Override @SuppressWarnings("unchecked") void importPlain(ImportContext context, Object obj, ObjId id) { // Get POJO value final Object value; try { value = obj.getClass().getMethod(this.getter.getName()).invoke(obj); } catch (Exception e) { return; } final Object coreValue = this.importCoreValue(context, value); // Set field core API value context.getTransaction().getTransaction().writeSimpleField(id, this.storageId, coreValue, true); }
@Override @SuppressWarnings("unchecked") void importPlain(ImportContext context, Object obj, ObjId id) { // Get POJO collection final Collection<?> objCollection; try { objCollection = (Collection<?>)obj.getClass().getMethod(this.getter.getName()).invoke(obj); } catch (Exception e) { return; } if (objCollection == null) return; // Get JCollectionField collection final Collection<Object> coreCollection = (Collection<Object>)this.readCoreCollection( context.getTransaction().getTransaction(), id); // Copy values over coreCollection.clear(); for (Object value : objCollection) coreCollection.add(this.elementField.importCoreValue(context, value)); }