public final SType<I> addDependentType(SType<?> type) { if (!isDependentType(type)) { if (dependentTypes == null) { dependentTypes = new LinkedHashSet<>(); } dependentTypes.add(type); } return this; }
public final boolean isDependentType(SType<?> type) { if (dependentTypes != null) { for (SType<?> d : dependentTypes) { if (type.isTypeOf(d)) { return true; } } } return superType != null && superType.isDependentType(type); }
public final boolean isDependentType(SType<?> type) { if (dependentTypes != null) { for (SType<?> d : dependentTypes) { if (type.isTypeOf(d)) { return true; } } } return superType != null && superType.isDependentType(type); }
public final SType<I> addDependentType(SType<?> type) { if (! isDependentType(type)) { if (type.hasDirectOrInderectDependentType(this)) { throw new SingularFormException( "Referência circular de dependência detectada ao tentar adicionar " + type + " como dependente de " + this); } if (dependentTypes == null) { dependentTypes = new LinkedHashSet<>(); } dependentTypes.add(type); } return this; }
/** Verifica se o tipo atual tem todos os tipos informados como campos dependentes. */ public AssertionsSType isDependentType(SType<?>... types) { for (SType<?> type : types) { if (!getTarget().isDependentType(type)) { throw new AssertionError(errorMsg("O tipo " + type + " não está como dependente de " + getTarget() + " ( isDependentType(type) retornou false)")); } } return this; }
/** Verifica se o tipo atual não possui nenhum dos tipos informados como campos dependentes. */ public AssertionsSType isNotDependentType(SType<?>... types) { for (SType<?> type : types) { if (getTarget().isDependentType(type)) { throw new AssertionError(errorMsg("O tipo " + type + " está como dependente de " + getTarget() + " ( isDependentType(type) retornou true)")); } } return this; }
.collect(toSet()); final Predicate<SType<?>> isDependent = (type) -> fieldInstance.getType().isDependentType(type); final Predicate<SType<?>> isElementsDependent = (type) -> type.isList() && isDependent.test(((STypeList<?, ?>) type).getElementsType());