@Override @Nullable public final <V> V getAttributeValue(@Nonnull String attributeFullName, @Nullable Class<V> resultClass) { return getAttributeValue(getDictionary().getAttributeReferenceOrException(attributeFullName), resultClass); }
@Nullable final SInstance findAttributeInstance(@Nonnull String fullName) { AttrInternalRef ref = getDictionary().getAttributeReferenceOrException(fullName); return AttributeValuesManagerForSType.findAttributeInstance(this, ref); }
/** * Looks for the best match implementation of the aspect being request. * <p>To understand the registration and retrieval process see {@link AspectRef}.</p> */ @Nonnull public <T> Optional<T> getAspect(@Nonnull AspectRef<T> aspectRef) { return getDictionary().getMasterAspectRegistry().getAspect(this, aspectRef); }
@Override @Nonnull protected SType<?> retrieve() { return RefType.this.get().getDictionary().getType(typeClass); } };
@Override public final boolean hasAttributeValueDirectly(@Nonnull AtrRef<?, ?, ?> atr) { AttrInternalRef ref = getDictionary().getAttributeReferenceOrException(atr); return AttributeValuesManager.staticGetAttributeDirectly(attributes, ref) != null; }
@Override public boolean hasAttributeDefinedDirectly(@Nonnull AtrRef<?, ?, ?> atr) { AttrInternalRef ref = getDictionary().getAttributeReferenceOrException(atr); return getAttributeDefinedLocally(ref) != null; }
@Override @Nonnull protected SType<?> retrieve() { return RefType.this.get().getDictionary().getType(typeClass); } };
@SuppressWarnings("unchecked") static <I extends SInstance> SIList<I> of(SType<I> elementsType) { SDictionary dictionary = elementsType.getDictionary(); STypeList<?, ?> type = dictionary.getType(STypeList.class); SIList<I> list = (SIList<I>) type.newInstance(); list.elementsType = elementsType; return list; }
@SuppressWarnings("unchecked") static <I extends SInstance> SIList<I> of(SType<I> elementsType) { SIList<I> lista = (SIList<I>) elementsType.getDictionary().getType(STypeList.class).newInstance(); lista.setType(elementsType.getDictionary().getType(STypeList.class)); lista.elementsType = elementsType; return lista; }
@Nullable public final <V> V getAttributeValue(@Nonnull AtrRef<?, ?, V> atr) { return getAttributeValue(getDictionary().getAttributeReferenceOrException(atr), atr.getValueClass()); }
/** * Verifica se o tipo e seu tipos internos (se existirem) extendem corretamente o tipo informado. Faz uma analise * recursiva para os subtipos. */ public AssertionsSType isExtensionCorrect(Class<? extends SType> typeClass) { return isExtensionCorrect(getTarget().getDictionary().getType(typeClass)); }
@Nonnull final <T extends SType<?>> T extendType(@Nullable SimpleName simpleNameNewType, @Nonnull T parentType) { if (getDictionary() != parentType.getDictionary()) { throw new SingularFormException( "O tipo " + parentType.getName() + " foi criado dentro de outro dicionário, que não o atual de " + getName()); } T newType = parentType.extend(simpleNameNewType); return registerTypeInternal(newType, null); }
final SInstance newAttributeInstanceFor(SType<?> typeToBeAppliedAttribute) { checkIfIsAttribute(); SInstance attrInstance; if (attrInternalRef.isSelfReference()) { attrInstance = typeToBeAppliedAttribute.newInstance(getDictionary().getInternalDicionaryDocument()); } else { attrInstance = newInstance(getDictionary().getInternalDicionaryDocument()); } attrInstance.setAsAttribute(attrInternalRef, typeToBeAppliedAttribute); return attrInstance; }
/** * This method create a predicate for verify if the instance have a element with the sortableProperty. * <p>Note: This verify with the name of the Stype. * * @return Predicate verify if have a Stype with the <code>sortableProperty</code> for a SIntance. */ private Predicate<SInstance> isCurrentSortInstance() { return i -> i.getType().isTypeOf(i.getType().getDictionary().getType(sortableProperty)) || SFormUtil.findChildByName(i, sortableProperty).isPresent(); }
final SInstance newAttributeInstanceFor(SType<?> typeToBeAppliedAttribute) { checkIfIsAttribute(); SInstance attrInstance; if (attributeDefinitionInfo.isSelfReference()) { attrInstance = typeToBeAppliedAttribute.newInstance(getDictionary().getInternalDicionaryDocument()); } else { attrInstance = newInstance(getDictionary().getInternalDicionaryDocument()); } attrInstance.setAsAttribute(getName(), this); return attrInstance; }
/** * Verifica se o tipo encontrado no caminho indicado é uma extensão direta do tipo informado. Para ser considerado * uma extensão direta, deverá ser da mesma classe do tipo (não pode ser derivado) e seu super tipo {@link * SType#getSuperType()} deve ser igual o tipo registrado no dicionário. */ public AssertionsSType isDirectExtensionOf(Class<? extends SType<?>> typeClass, String fieldPath) { SType<?> expectedSuperType = getTarget().getDictionary().getType(typeClass); if (fieldPath != null) { expectedSuperType = expectedSuperType.getLocalType(fieldPath); } return isDirectExtensionOf(expectedSuperType); }
public SType<?> tableContext(SType<?> type) { SType<?> result = type; while (table(result) == null && !result.getParentScope().equals(result.getPackage())) { result = result.getDictionary().getType(result.getParentScope().getName()); } return result; }
public static SIPersistenceArchive toArchive(SType<?> type) { ContextArchive ctx = new ContextArchive(type.getDictionary()); ctx.getArchive().setRootTypeName(type.getName()); ensureType(ctx, type); return ctx.getArchive(); }
public static SIPersistenceArchive toArchive(SType<?> type) { ContextArchive ctx = new ContextArchive(type.getDictionary()); ctx.getArchive().setRootTypeName(type.getName()); ensureType(ctx, type); return ctx.getArchive(); }
final <T extends SType<?>> T extendType(String simpleNameNewType, T parentType) { if (getDictionary() != parentType.getDictionary()) { throw new SingularFormException( "O tipo " + parentType.getName() + " foi criado dentro de outro dicionário, que não o atual de " + getName()); } T newType = parentType.extend(simpleNameNewType); return registerType(newType, null); }