/** * Get the item type of the function item * * @return the function item's type */ public FunctionItemType getFunctionItemType() { SequenceType resultType = targetType.getResultTypeOfCast(); SequenceType argType = allowEmpty ? SequenceType.OPTIONAL_ATOMIC : SequenceType.SINGLE_ATOMIC; return new SpecificFunctionType( new SequenceType[]{argType}, resultType); }
/** * Get the name of the function, or null if it is anonymous * * @return the function name, or null for an anonymous inline function */ public StructuredQName getFunctionName() { return targetType.getStructuredQName(); }
/** * The toString() method for an expression attempts to give a representation of the expression * in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath. * In the case of XSLT instructions, the toString() method gives an abstracted view of the syntax */ public String toString() { return targetType.getEQName() + "(" + getBaseExpression().toString() + ")"; }
return targetType.getTypedValue(value.getStringValueCS(), resolver, rules); } catch (ValidationException e) { e.setErrorCode("FORG0001"); Iterable<PlainType> memberTypes = targetType.getPlainMemberTypes(); if (targetType.isPlainType()) { for (PlainType member : memberTypes) { if (label.equals(member)) { if (result instanceof AtomicValue) { if (!targetType.isPlainType()) { ValidationFailure vf = targetType.checkAgainstFacets((AtomicValue)result, rules); if (vf == null) { return (AtomicValue) result; throw new XPathException("Cannot convert the supplied value to " + targetType.getDescription(), "FORG0001");
return targetType.getTypedValue(value.getStringValueCS(), nsResolver, rules); } catch (ValidationException e) { e.setErrorCode("FORG0001"); Iterable<PlainType> memberTypes = targetType.getPlainMemberTypes(); throw new XPathException("Cannot convert the supplied value to " + targetType.getDescription(), "FORG0001");
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter out) throws XPathException { out.startElement("castToUnion", this); out.emitAttribute("as", targetType.toExportString()); getBaseExpression().export(out); out.endElement(); }
for (PlainType member: getPlainMemberTypes()) { message.append(punctuation); punctuation = ", ";
/** * Get the static cardinality of the expression */ public int computeCardinality() { int c = StaticProperty.ALLOWS_ONE; if (allowEmpty && Cardinality.allowsZero(getBaseExpression().getCardinality())) { c |= StaticProperty.ALLOWS_ZERO; } try { if (targetType.containsListType()) { c |= StaticProperty.ALLOWS_ZERO; c |= StaticProperty.ALLOWS_MANY; } } catch (MissingComponentException e) { c |= StaticProperty.ALLOWS_ZERO; c |= StaticProperty.ALLOWS_MANY; } return c; }
return targetType.getTypedValue(value.getStringValueCS(), resolver, rules); } catch (ValidationException e) { e.setErrorCode("FORG0001"); Iterable<PlainType> memberTypes = targetType.getPlainMemberTypes(); if (targetType.isPlainType()) { for (PlainType member : memberTypes) { if (label.equals(member)) { if (result instanceof AtomicValue) { if (!targetType.isPlainType()) { ValidationFailure vf = targetType.checkAgainstFacets((AtomicValue)result, rules); if (vf == null) { return (AtomicValue) result; throw new XPathException("Cannot convert the supplied value to " + targetType.getDescription(), "FORG0001");
return targetType.getTypedValue(value.getStringValueCS(), nsResolver, rules); } catch (ValidationException e) { e.setErrorCode("FORG0001"); Iterable<PlainType> memberTypes = targetType.getPlainMemberTypes(); throw new XPathException("Cannot convert the supplied value to " + targetType.getDescription(), "FORG0001");
out.emitAttribute("as", ((UnionCastableFunction) target).getTargetType().toExportString()); for (Operand o : operands()) { o.getChildExpression().export(out); out.emitAttribute("as", ((UnionConstructorFunction) target).getTargetType().toExportString()); for (Operand o : operands()) { o.getChildExpression().export(out);
for (PlainType member: getPlainMemberTypes()) { message.append(punctuation); punctuation = ", ";
out.emitAttribute("as", ((UnionCastableFunction) target).getTargetType().toExportString()); for (Operand o : operands()) { o.getChildExpression().export(out); out.emitAttribute("as", ((UnionConstructorFunction) target).getTargetType().toExportString()); for (Operand o : operands()) { o.getChildExpression().export(out);
/** * Get the item type of the function item * * @return the function item's type */ public FunctionItemType getFunctionItemType() { SequenceType resultType = targetType.getResultTypeOfCast(); SequenceType argType = allowEmpty ? SequenceType.OPTIONAL_ATOMIC : SequenceType.SINGLE_ATOMIC; return new SpecificFunctionType( new SequenceType[]{argType}, resultType); }
/** * Get the name of the function, or null if it is anonymous * * @return the function name, or null for an anonymous inline function */ public StructuredQName getFunctionName() { return targetType.getStructuredQName(); }