/** * * @param header * a subtype of element type of the list. * it can not be the very element type of the list * in order to use de element type as header it is necessary to define a displayString and call {@link #SViewListByForm()} */ public SViewListByForm(SType header) { this.headerPath = header.getNameSimple(); }
final void register(SType<?> type) { if(isRecursiveReference()) { ((SScopeBase) getParentScope()).register(type); } else { verifyIfMayAddNewType(type.getNameSimpleObj()); if (localTypes == null) { localTypes = new LinkedHashMap<>(); } localTypes.put(type.getNameSimple(), type); } }
public TripleConverter(SType left, SType middle, SType right) { this.left = left.getNameSimple(); this.middle = middle.getNameSimple(); this.right = right.getNameSimple(); }
public TripleConverter(SType left, SType middle, SType right) { this.left = left.getNameSimple(); this.middle = middle.getNameSimple(); this.right = right.getNameSimple(); }
private void addInterno(SType<?> field) { if (fields == null) { fields = new LinkedHashMap<>(); } fields.put(field.getNameSimple(), new FieldRef(field)); }
/** * Obtém o valor de um campo a partir do seu tipo O campo deve ser filho * imediato desse MTipo * * @param field Tipo do campo filho */ public Object getValue(SType<?> field) { return getValue(field.getNameSimple()); }
/** * Obtém o valor de um campo a partir do seu tipo O campo deve ser filho * imediato desse MTipo * * @param field Tipo do campo filho */ public Object getValue(SType<?> field) { return getValue(field.getNameSimple()); }
private String getFormSimpleName(String formTypeName) { if (StringUtils.isBlank(formTypeName)) { return null; } return singularFormConfig .flatMap(formConfig -> formConfig.getTypeLoader().loadType(formTypeName)) .map(type -> type.getNameSimple()) .map(String::toUpperCase) .orElse(null); }
private String getFormSimpleName(String formTypeName) { if (StringUtils.isBlank(formTypeName)) { return null; } return singularFormConfig .flatMap(formConfig -> formConfig.getTypeLoader().loadType(formTypeName)) .map(type -> type.getNameSimple()) .map(String::toUpperCase) .orElse(null); }
/** * Add a new tab to the view tab. * * @param type the type of the field added to the tab * @param title the title of the tab * @return the new tab created */ public STab addTab(SType<?> type, String title) { return addTab(type.getNameSimple(), title) .add(type); }
private void debugAttributesDefined(Appendable appendable, int level) { attributesDefined.getAttributes().stream().filter(att -> !getLocalTypeOptional(att.getNameSimple()) .isPresent()).forEach(att -> { try { pad(appendable, level + 1).append("att ").append(suppressPackage(att.getName())) .append(':').append(suppressPackage(att.getSuperType().getName())).append( att.isSelfReference() ? " SELF" : "").append('\n'); } catch (IOException ex) { LOGGER.log(Level.SEVERE, ex.getMessage(), ex); } }); }
private void prepareDefaultImports(SDictionary dictionary) { for (SType<?> type : dictionary.getType(SType.class).getPackage().getLocalTypes()) { imports.put(type.getNameSimple(), type.getName()); } }
/** * Retorna todos os campos do tipo, instanciando os que ainda não foram. * * @return instancias dos campos */ @Nonnull public List<SInstance> getAllFields() { for (SType<?> field : getType().getFields()) getField(field.getNameSimple()); return getFields(); }
@SuppressWarnings("unchecked") private void addForms(BoxConfigurationData boxConfigurationMetadata) { for (Class<? extends SType<?>> formClass : singularModuleConfiguration.getFormTypes()) { String name = SFormUtil.getTypeName(formClass); Optional<SType<?>> sTypeOptional = singularFormConfig.getTypeLoader().loadType(name); if (sTypeOptional.isPresent()) { SType<?> sType = sTypeOptional.get(); String label = sType.asAtr().getLabel(); boxConfigurationMetadata.getForms().add(new FormDTO(name, sType.getNameSimple(), label)); } } }
DiffInfo(SInstance original, SInstance newer, DiffType type) { this.original = original; this.newer = newer; this.type = type; //Copia dados básicos para o caso do diff ser serializado SInstance instance = newer == null ? original : newer; this.simpleName = instance.getType().getNameSimple(); this.simpleLabel = instance.getType().asAtr().getLabel(); }
DiffInfo(SInstance original, SInstance newer, DiffType type) { this.original = original; this.newer = newer; this.type = type; //Copia dados básicos para o caso do diff ser serializado SInstance instance = newer == null ? original : newer; this.simpleName = instance.getType().getNameSimple(); this.simpleLabel = instance.getType().asAtr().getLabel(); }
/** * Retorna todos os campos do tipo, instanciando os que ainda não foram. * * @return instancias dos campos */ public List<SInstance> getAllFields() { for (SType<?> field : getType().getFields()) getField(field.getNameSimple()); return getFields(); }
@Override public void fillInstance(SInstance ins, T obj) { if (!(ins instanceof SIComposite)) { throw new SingularFormException("AutoSICompositeConverter somente funciona com instancias compostas."); } final SIComposite cins = (SIComposite) ins; final GetterHandler getterHandler = new Mirror().on(obj).get(); cins.getType().getFields().forEach(f -> cins.setValue(f, getterHandler.field(f.getNameSimple()))); }
@Override public void fillInstance(SInstance ins, T obj) { if (!(ins instanceof SIComposite)) { throw new SingularFormException("AutoSICompositeConverter somente funciona com instancias compostas.", ins); } final SIComposite cins = (SIComposite) ins; final GetterHandler getterHandler = new Mirror().on(obj).get(); cins.getType().getFields().forEach(f -> cins.setValue(f, getterHandler.field(f.getNameSimple()))); }
private static void writeType(ContextArchive ctx, SIPersistenceType pType, SType<?> type) { pType.setSuperType(ctx.translateImport(type.getSuperType())); ensureType(ctx, type.getSuperType()); if (type.isComposite()) { //TODO (por Daniel Bordin) O código abaixo ainda precisa resolver a questão de field que foram extendido // e tiveram apenas uma atributo alterado for (SType<?> localField : ((STypeComposite<?>) type).getFieldsLocal()) { SIPersistenceType pMember = pType.addMember(localField.getNameSimple()); writeType(ctx, pMember, localField); } } }