@Override public void fillInstance(SInstance ins, T obj) { ins.setValue(obj); }
@Override public void fillInstance(SInstance ins, T obj) { ins.setValue(obj); }
@Override public void fillInstance(SInstance ins, T obj) { ins.setValue(obj.name()); }
@Override public void fillInstance(SInstance ins, T obj) { ins.setValue(obj.name()); }
public E addValue(Object value) { E instance = addNew(); try { instance.setValue(value); } catch (RuntimeException e) { //Senão conseguiu converter o valor, então desfaz a inclusão values.remove(values.size() - 1); throw e; } return instance; }
public void fromRelationalColumn(Object dbData, SInstance toInstance) { if (dbData == null) { toInstance.clearInstance(); } else { toInstance.setValue(dbData.toString()); } } }
public E addValue(Object value) { E instance = addNew(); try { instance.setValue(value); } catch (RuntimeException e) { //Senão conseguiu converter o valor, então desfaz a inclusão values.remove(values.size() - 1); throw e; } return instance; }
@Override @SuppressWarnings({ "unchecked", "rawtypes" }) public void setObject(T object) { SInstance target = getTarget(); if (target instanceof SIList) { target.clearInstance(); ((List) object).forEach(((SIList) target)::addValue); } else { target.setValue(object); } }
@Override @SuppressWarnings({ "unchecked", "rawtypes" }) public void setObject(T object) { SInstance target = getTarget(); if (target instanceof SIList) { target.clearInstance(); ((List) object).forEach(((SIList) target)::addValue); } else { target.setValue(object); } }
private void rollbackState() { try { if (adding) { listModel.getObject().remove(listModel.getObject().size() - 1); } else { MElement xml = MParser.parse(instanceBackupXml); SInstance i = SFormXMLUtil.fromXML(currentInstance.getObject().getType(), xml); currentInstance.getObject().setValue(i); } } catch (Exception e) { throw SingularException.rethrow(e.getMessage(), e); } }
private void rollbackState() { try { if (adding) { listModel.getObject().remove(listModel.getObject().size() - 1); } else { MElement xml = MParser.parse(instanceBackupXml); SInstance i = MformPersistenciaXML.fromXML(currentInstance.getObject().getType(), xml); currentInstance.getObject().setValue(i); } } catch (Exception e) { throw SingularException.rethrow(e.getMessage(), e); } }
/** Retorna o atributo se existir associado no mapa atual de atributos. */ @Nullable public SInstance get(@Nonnull AttrInternalRef ref) { SInstance instance = ArrUtil.arrayGet(attributes, ref.getIndex()); if (instance != null && instance.isAttributeShouldMigrate() && ref.isResolved()) { //Precida migra o atributo de String para o tipo definitivo, pois a carga do valor foi lazy SInstance newAttr = createNewAttribute(ref); newAttr.setValue(instance.getValue()); return set(ref, newAttr); } return instance; }
@Override public void setMember(String name, Object value) { int index = findIndexOf(name); if (index == -1) { super.setMember(name, value); } else { getFieldWrapper(index).getInstance().setValue(value); } } }
@Override public void setMember(String name, Object value) { int index = findIndexOf(name); if (index == -1) { super.setMember(name, value); } else { getFieldWrapper(index).getInstance().setValue(value); } } }
@SuppressWarnings("unchecked") private static void realMapToSInstance(Map<Integer, Map<String, Object>> pojoReferenceDataMap, Object pojoDataMap, SInstance rootInstance, boolean strictMode) { SType<?> type = rootInstance.getType(); if (type.isComposite()) { mapToSIComposite(pojoReferenceDataMap, (Map<String, Object>) pojoDataMap, (SIComposite) rootInstance, strictMode); } else if (type.isList()) { mapToSIList(pojoReferenceDataMap, (Map<String, Object>) pojoDataMap, (SIList<SInstance>) rootInstance, strictMode, type); } else { rootInstance.setValue(((Map<String, Object>) pojoDataMap).get(type.getNameSimple())); } }