/** * Get extra diagnostic information about why a supplied item does not conform to this * item type, if available. If extra information is returned, it should be in the form of a complete * sentence, minus the closing full stop. No information should be returned for obvious cases. * * @param item the item that doesn't match this type * @param th the type hierarchy cache * @return optionally, a message explaining why the item does not match the type */ @Override public Optional<String> explainMismatch(Item item, TypeHierarchy th) { Optional<String> explanation = super.explainMismatch(item, th); if (explanation.isPresent()) { return explanation; } return Optional.of("The node has the wrong local name"); }
/** * Get extra diagnostic information about why a supplied item does not conform to this * item type, if available. If extra information is returned, it should be in the form of a complete * sentence, minus the closing full stop. No information should be returned for obvious cases. * * @param item the item that doesn't match this type * @param th the type hierarchy cache * @return optionally, a message explaining why the item does not match the type */ @Override public Optional<String> explainMismatch(Item item, TypeHierarchy th) { Optional<String> explanation = super.explainMismatch(item, th); if (explanation.isPresent()) { return explanation; } return Optional.of("The node has the wrong name"); }
/** * Get extra diagnostic information about why a supplied item does not conform to this * item type, if available. If extra information is returned, it should be in the form of a complete * sentence, minus the closing full stop. No information should be returned for obvious cases. * * @param item the item that doesn't match this type * @param th the type hierarchy cache * @return optionally, a message explaining why the item does not match the type */ @Override public Optional<String> explainMismatch(Item item, TypeHierarchy th) { Optional<String> explanation = super.explainMismatch(item, th); if (explanation.isPresent()) { return explanation; } return Optional.of("The node has the wrong local name"); }
/** * Get extra diagnostic information about why a supplied item does not conform to this * item type, if available. If extra information is returned, it should be in the form of a complete * sentence, minus the closing full stop. No information should be returned for obvious cases. * * @param item the item that doesn't match this type * @param th the type hierarchy cache * @return optionally, a message explaining why the item does not match the type */ @Override public Optional<String> explainMismatch(Item item, TypeHierarchy th) { Optional<String> explanation = super.explainMismatch(item, th); if (explanation.isPresent()) { return explanation; } return Optional.of("The node is in the wrong namespace"); }
/** * Get extra diagnostic information about why a supplied item does not conform to this * item type, if available. If extra information is returned, it should be in the form of a complete * sentence, minus the closing full stop. No information should be returned for obvious cases. * * @param item the item that doesn't match this type * @param th the type hierarchy cache * @return optionally, a message explaining why the item does not match the type */ @Override public Optional<String> explainMismatch(Item item, TypeHierarchy th) { Optional<String> explanation = super.explainMismatch(item, th); if (explanation.isPresent()) { return explanation; } return Optional.of("The node is in the wrong namespace"); }
/** * Get extra diagnostic information about why a supplied item does not conform to this * item type, if available. If extra information is returned, it should be in the form of a complete * sentence, minus the closing full stop. No information should be returned for obvious cases. * * @param item the item that doesn't match this type * @param th the type hierarchy cache * @return optionally, a message explaining why the item does not match the type */ @Override public Optional<String> explainMismatch(Item item, TypeHierarchy th) { Optional<String> explanation = super.explainMismatch(item, th); if (explanation.isPresent()) { return explanation; } return Optional.of("The node has the wrong name"); }
/** * Get extra diagnostic information about why a supplied item does not conform to this * item type, if available. If extra information is returned, it should be in the form of a complete * sentence, minus the closing full stop. No information should be returned for obvious cases. * * @param item the item that doesn't match this type * @param th the type hierarchy cache * @return optionally, a message explaining why the item does not match the type */ @Override public Optional<String> explainMismatch(Item item, TypeHierarchy th) { Optional<String> explanation = super.explainMismatch(item, th); if (explanation.isPresent()) { return explanation; } if (operator == Token.INTERSECT) { // the most common case if (!nodetest1.matchesNode((NodeInfo)item)) { return nodetest1.explainMismatch(item, th); } else if (!nodetest2.matchesNode((NodeInfo)item)) { return nodetest2.explainMismatch(item, th); } } return Optional.empty(); }
/** * Get extra diagnostic information about why a supplied item does not conform to this * item type, if available. If extra information is returned, it should be in the form of a complete * sentence, minus the closing full stop. No information should be returned for obvious cases. * * @param item the item that doesn't match this type * @param th the type hierarchy cache * @return optionally, a message explaining why the item does not match the type */ @Override public Optional<String> explainMismatch(Item item, TypeHierarchy th) { Optional<String> explanation = super.explainMismatch(item, th); if (explanation.isPresent()) { return explanation; } if (operator == Token.INTERSECT) { // the most common case if (!nodetest1.matchesNode((NodeInfo)item)) { return nodetest1.explainMismatch(item, th); } else if (!nodetest2.matchesNode((NodeInfo)item)) { return nodetest2.explainMismatch(item, th); } } return Optional.empty(); }
Optional<String> explanation = super.explainMismatch(item, th); if (explanation.isPresent()) { return explanation; String s = "The supplied document node has an element child (" + Err.depict(n) + ") that does not satisfy the element test"; Optional<String> more = elementTest.explainMismatch(n, th); if (more.isPresent()) { s += ". " + more.get();
Optional<String> explanation = super.explainMismatch(item, th); if (explanation.isPresent()) { return explanation; String s = "The supplied document node has an element child (" + Err.depict(n) + ") that does not satisfy the element test"; Optional<String> more = elementTest.explainMismatch(n, th); if (more.isPresent()) { s += ". " + more.get();
/** * Get extra diagnostic information about why a supplied item does not conform to this * item type, if available. If extra information is returned, it should be in the form of a complete * sentence, minus the closing full stop. No information should be returned for obvious cases. * * @param item the item that doesn't match this type * @param th the type hierarchy cache * @return optionally, a message explaining why the item does not match the type */ @Override public Optional<String> explainMismatch(Item item, TypeHierarchy th) { Optional<String> explanation = super.explainMismatch(item, th); if (explanation.isPresent()) { return explanation; } if (item instanceof NodeInfo) { UType actualKind = UType.getUType(item); if (!getUType().overlaps(actualKind)) { return Optional.of("The supplied value is " + actualKind.toStringWithIndefiniteArticle()); } else { return Optional.empty(); } } else { return Optional.of("The supplied value is " + item.getGenre().getDescription()); } }
/** * Get extra diagnostic information about why a supplied item does not conform to this * item type, if available. If extra information is returned, it should be in the form of a complete * sentence, minus the closing full stop. No information should be returned for obvious cases. * * @param item the item that doesn't match this type * @param th the type hierarchy cache * @return optionally, a message explaining why the item does not match the type */ @Override public Optional<String> explainMismatch(Item item, TypeHierarchy th) { Optional<String> explanation = super.explainMismatch(item, th); if (explanation.isPresent()) { return explanation; } if (item instanceof NodeInfo) { UType actualKind = UType.getUType(item); if (!getUType().overlaps(actualKind)) { return Optional.of("The supplied value is " + actualKind.toStringWithIndefiniteArticle()); } else { return Optional.empty(); } } else { return Optional.of("The supplied value is " + item.getGenre().getDescription()); } }
/** * Get extra diagnostic information about why a supplied item does not conform to this * item type, if available. If extra information is returned, it should be in the form of a complete * sentence, minus the closing full stop. No information should be returned for obvious cases. * * @param item the item that doesn't match this type * @param th the type hierarchy cache * @return optionally, a message explaining why the item does not match the type */ @Override public Optional<String> explainMismatch(Item item, TypeHierarchy th) { Optional<String> explanation = super.explainMismatch(item, th); if (explanation.isPresent()) { return explanation; } NodeInfo node = (NodeInfo) item; if (!matchesAnnotation(((NodeInfo)item).getSchemaType())) { if (node.getSchemaType() == Untyped.getInstance()) { return Optional.of("The supplied node has not been schema-validated"); } if (node.getSchemaType() == BuiltInAtomicType.UNTYPED_ATOMIC) { return Optional.of("The supplied node has not been schema-validated"); } return Optional.of("The supplied node has the wrong type annotation (" + node.getSchemaType().getDescription() + ")"); } if (Nilled_1.isNilled(node) && !nillable) { return Optional.of("The supplied node has xsi:nil='true', which the required type does not allow"); } return Optional.empty(); }
/** * Get extra diagnostic information about why a supplied item does not conform to this * item type, if available. If extra information is returned, it should be in the form of a complete * sentence, minus the closing full stop. No information should be returned for obvious cases. * * @param item the item that doesn't match this type * @param th the type hierarchy cache * @return optionally, a message explaining why the item does not match the type */ @Override public Optional<String> explainMismatch(Item item, TypeHierarchy th) { Optional<String> explanation = super.explainMismatch(item, th); if (explanation.isPresent()) { return explanation; } NodeInfo node = (NodeInfo) item; if (!matchesAnnotation(((NodeInfo)item).getSchemaType())) { if (node.getSchemaType() == Untyped.getInstance()) { return Optional.of("The supplied node has not been schema-validated"); } if (node.getSchemaType() == BuiltInAtomicType.UNTYPED_ATOMIC) { return Optional.of("The supplied node has not been schema-validated"); } return Optional.of("The supplied node has the wrong type annotation (" + node.getSchemaType().getDescription() + ")"); } if (Nilled_1.isNilled(node) && !nillable) { return Optional.of("The supplied node has xsi:nil='true', which the required type does not allow"); } return Optional.empty(); }