/** * Get the underlying implementation object representing the value. This method allows * access to lower-level Saxon functionality, including classes and methods that offer * no guarantee of stability across releases. * * @return the underlying implementation object representing the value * @since 9.8 (previously inherited from XdmValue which returns a Sequence) */ @Override public Item<?> getUnderlyingValue() { return (Item)super.getUnderlyingValue(); }
public Sequence<?> convert(Object object, XPathContext context) throws XPathException { return ((XdmValue)object).getUnderlyingValue(); }
/** * Get the underlying implementation object representing the value. This method allows * access to lower-level Saxon functionality, including classes and methods that offer * no guarantee of stability across releases. * * @return the underlying implementation object representing the value * @since 9.8 (previously inherited from XdmValue which returns a Sequence) */ @Override public Item<?> getUnderlyingValue() { return (Item)super.getUnderlyingValue(); }
public Sequence<?> convert(Object object, XPathContext context) throws XPathException { return ((XdmValue)object).getUnderlyingValue(); }
@Override public HashTrieMap populateResultMap(HashTrieMap resultMap) { for (Map.Entry<String, XdmValue> entry : results.entrySet()) { String uri = entry.getKey(); resultMap = resultMap.addEntry(new StringValue(uri), entry.getValue().getUnderlyingValue()); } return resultMap; } }
@Override public HashTrieMap populateResultMap(HashTrieMap resultMap) { for (Map.Entry<String, XdmValue> entry : results.entrySet()) { String uri = entry.getKey(); resultMap = resultMap.addEntry(new StringValue(uri), entry.getValue().getUnderlyingValue()); } return resultMap; } }
/** * Create an XdmArray supplying the members as an array of XdmValue objects * * @param members an array of XdmValue objects. Note that subsequent changes to the array will have no effect * on the XdmValue. */ public XdmArray(XdmValue[] members) { List<GroundedValue<?>> values = new ArrayList<>(); for (XdmValue member : members) { values.add(member.getUnderlyingValue()); } setValue(new SimpleArrayItem(values)); }
/** * Create an XdmArray supplying the members as an array of XdmValue objects * * @param members an array of XdmValue objects. Note that subsequent changes to the array will have no effect * on the XdmValue. */ public XdmArray(XdmValue[] members) { List<GroundedValue<?>> values = new ArrayList<>(); for (XdmValue member : members) { values.add(member.getUnderlyingValue()); } setValue(new SimpleArrayItem(values)); }
/** * Create an XdmArray supplying the members as a collection of XdmValue objects * * @param members a sequence of XdmValue objects. Note that if this is supplied as a list or similar * collection, subsequent changes to the list/collection will have no effect on the XdmValue. * Note that the argument can be a single XdmValue representing a sequence, in which case the * constructed array will have one member for each item in the supplied sequence. */ public XdmArray(Iterable<? extends XdmValue> members) { List<GroundedValue<?>> values = new ArrayList<>(); for (XdmValue member : members) { values.add(member.getUnderlyingValue()); } setValue(new SimpleArrayItem(values)); }
@Override public Sequence<?> getPrimaryResult() throws XPathException { Sequence<?> actualResult = primaryDestination.getXdmValue().getUnderlyingValue(); return postProcess(baseOutputUri, actualResult); }
/** * Set the value of external variable defined in the query * @param name the name of the external variable, as a QName * @param value the value of the external variable, or null to clear a previously set value */ public void setExternalVariable(QName name, XdmValue value) { context.setParameter(name.getClarkName(), (value == null ? null : value.getUnderlyingValue())); }
@Override public Sequence<?> getPrimaryResult() throws XPathException { Sequence<?> actualResult = primaryDestination.getXdmValue().getUnderlyingValue(); return postProcess(baseOutputUri, actualResult); }
/** * Set the value of a stylesheet parameter * @param name the name of the stylesheet parameter, as a QName * @param value the value of the stylesheet parameter, or null to clear a previously set value */ public void setParameter(QName name, XdmValue value) { controller.setParameter(name.getStructuredQName(), (value == null ? null : value.getUnderlyingValue())); }
/** * Create an XdmMap supplying the entries in the form of a Java Map, * where the keys and values in the Java Map are XDM values * * @param map a Java map whose entries are the (key, value) pairs * @since 9.8 */ public XdmMap(Map<? extends XdmAtomicValue, ? extends XdmValue> map) { HashTrieMap val = new HashTrieMap(); for (Map.Entry<? extends XdmAtomicValue, ? extends XdmValue> entry : map.entrySet()) { val.initialPut(entry.getKey().getUnderlyingValue(), entry.getValue().getUnderlyingValue()); } setValue(val); }
/** * Create an XdmMap supplying the entries in the form of a Java Map, * where the keys and values in the Java Map are XDM values * * @param map a Java map whose entries are the (key, value) pairs * @since 9.8 */ public XdmMap(Map<? extends XdmAtomicValue, ? extends XdmValue> map) { HashTrieMap val = new HashTrieMap(); for (Map.Entry<? extends XdmAtomicValue, ? extends XdmValue> entry : map.entrySet()) { val.initialPut(entry.getKey().getUnderlyingValue(), entry.getValue().getUnderlyingValue()); } setValue(val); }
/** * Get an iterator over the items in this value. * * @return an Iterator over the items in this value. * @throws SaxonApiUncheckedException if the value is lazily evaluated and the delayed * evaluation fails with a dynamic error. */ public Iterator<XdmItem> iterator() throws SaxonApiUncheckedException { try { Sequence<?> v = getUnderlyingValue(); return new XdmSequenceIterator<>(v.iterate()); } catch (XPathException e) { throw new SaxonApiUncheckedException(e); } }
/** * Set the value of external variable defined in the query * * @param name the name of the external variable, as a QName * @param value the value of the external variable, or null to clear a previously set value * @throws SaxonApiUncheckedException if the value is evaluated lazily, and evaluation fails */ public void setExternalVariable(QName name, XdmValue value) { try { context.setParameter(name.getStructuredQName(), value == null ? null : ((Sequence<?>) value.getUnderlyingValue()).materialize()); } catch (XPathException e) { throw new SaxonApiUncheckedException(e); } }
/** * Create a new map containing an additional (key, value) pair. * If there is an existing entry with the same key, it is removed * @return a new map containing the additional entry. The original map is unchanged. */ public XdmMap put(XdmAtomicValue key, XdmValue value) { XdmMap map2 = new XdmMap(); map2.setValue(getUnderlyingValue().addEntry(key.getUnderlyingValue(), value.getUnderlyingValue())); return map2; }
/** * Create a new map containing an additional (key, value) pair. * If there is an existing entry with the same key, it is removed * @return a new map containing the additional entry. The original map is unchanged. */ public XdmMap put(XdmAtomicValue key, XdmValue value) { XdmMap map2 = new XdmMap(); map2.setValue(getUnderlyingValue().addEntry(key.getUnderlyingValue(), value.getUnderlyingValue())); return map2; }
private Sequence[] typeCheckFunctionArguments(UserFunction uf, XdmValue[] arguments) throws XPathException { Configuration config = processor.getUnderlyingConfiguration(); UserFunctionParameter[] params = uf.getParameterDefinitions(); GroundedValue<?>[] vr = (GroundedValue<?>[])new GroundedValue[arguments.length]; for (int i = 0; i < arguments.length; i++) { net.sf.saxon.value.SequenceType type = params[i].getRequiredType(); vr[i] = arguments[i].getUnderlyingValue(); if (!type.matches(vr[i], config.getTypeHierarchy())) { RoleDiagnostic role = new RoleDiagnostic(RoleDiagnostic.FUNCTION, uf.getFunctionName().getDisplayName(), i); Sequence<?> converted = config.getTypeHierarchy().applyFunctionConversionRules(vr[i], type, role, ExplicitLocation.UNKNOWN_LOCATION); vr[i] = converted.materialize(); } } return vr; }