/** * Add is-abstract annotation to a var * @param var var to be marked * @param type type from which metadata extracted */ private static VarPattern isAbstract(VarPattern var, Type type) { return type.isAbstract() ? var.isAbstract() : var; }
@Override protected final boolean filter(T schemaConcept) { return willIncludeAbstractTypes() || !schemaConcept.isAbstract(); }
@Override public Collection<PropertyExecutor> undefine(Var var) throws GraqlQueryException { PropertyExecutor.Method method = executor -> { Type type = executor.get(var).asType(); if (!type.isDeleted()) { type.isAbstract(false); } }; return ImmutableSet.of(PropertyExecutor.builder(method).requires(var).build()); }
@Override public Collection<PropertyExecutor> define(Var var) throws GraqlQueryException { PropertyExecutor.Method method = executor -> { Concept concept = executor.get(var); if (concept.isType()) { concept.asType().isAbstract(true); } else { throw GraqlQueryException.insertAbstractOnNonType(concept.asSchemaConcept()); } }; return ImmutableSet.of(PropertyExecutor.builder(method).requires(var).build()); }