private void debugAttribute(Appendable appendable, SInstance attr) { try { if (!attr.getAttributeInstanceInfo().getRef().isResolved()) { appendable.append('?'); } appendable.append(suppressPackage(attr.getAttributeInstanceInfo().getName(), true)).append("=") .append(attr.toStringDisplay()).append("; "); } catch (IOException ex) { LOGGER.log(Level.SEVERE, ex.getMessage(), ex); } }
public static void assertEqualsAttribute(SAttributeEnabled copy, SInstance atrOriginal) { Optional<SInstance> atrNewOpt = copy.getAttributeDirectly(atrOriginal.getAttributeInstanceInfo().getName()); try { assertThat(atrNewOpt).isPresent(); if (atrNewOpt.isPresent()) { assertEquivalentInstance(atrOriginal, atrNewOpt.get(), false); } } catch (AssertionError e) { throw new AssertionError( "Erro comparando atributo '" + atrOriginal.getAttributeInstanceInfo().getName() + "'", e); } }
private void debugAttributes(Appendable appendable) { try { Collection<SInstance> attrs = getAttributes(); if (! attrs.isEmpty()) { appendable.append(" {"); attrs.stream().forEach(attr -> { try { appendable.append(suppressPackage(attr.getAttributeInstanceInfo().getName(), true)).append("=") .append(attr.toStringDisplay()).append("; "); } catch (IOException ex) { LOGGER.log(Level.SEVERE, ex.getMessage(), ex); } }); appendable.append("}"); } } catch (IOException ex) { LOGGER.log(Level.SEVERE, ex.getMessage(), ex); } }
private MElement complement(SInstance instance, MElement element) { Integer id = instance.getId(); if (builder.isPersistId()) { element.setAttribute(ID_ATTRIBUTE, id.toString()); } if (builder.isPersistAttributes()) { for (SInstance atr : instance.getAttributes()) { String name = atr.getAttributeInstanceInfo().getName(); if (atr instanceof SISimple) { String sPersistence = ((SISimple<?>) atr).toStringPersistence(); element.setAttribute(name, sPersistence); } else { throw new SingularFormException("Não implementada a persitência de atributos compostos: " + name, instance); } } } return element; } }
private MElement complement(SInstance instancia, MElement element) { if (builder.isPersistId() && instancia.getId() != null) { element.setAttribute(ATRIBUTO_ID, instancia.getId().toString()); } if (builder.isPersistAttributes()) { for (SInstance atr : instancia.getAttributes()) { String name = atr.getAttributeInstanceInfo().getName(); if (atr instanceof SISimple) { String sPersistence = ((SISimple<?>) atr).toStringPersistence(); element.setAttribute(name, sPersistence); } else { throw new SingularFormException("Não implementada a persitência de atributos compostos: " + name, instancia); } } } return element; } }