/** * Returns true if the path starts with variable name ($...). */ default boolean startsWithVariable() { return !isEmpty() && ItemPath.isVariable(first()); }
/** * Returns the value of the first segment if it is a variable name segment; otherwise null. */ default QName firstToVariableNameOrNull() { if (isEmpty()) { return null; } else { Object first = first(); return isVariable(first) ? toVariableName(first) : null; } }
if (ItemPath.isName(segment)) { sb.append(PrettyPrinter.prettyPrint(ItemPath.toName(segment))); } else if (ItemPath.isVariable(segment)) { sb.append(PrettyPrinter.prettyPrint(ItemPath.toVariableName(segment))); } else {
static boolean segmentsEquivalent(Object o1, Object o2) { if (ItemPath.isName(o1)) { return ItemPath.isName(o2) && QNameUtil.match(ItemPath.toName(o1), ItemPath.toName(o2)); } else if (ItemPath.isVariable(o1)) { return ItemPath.isVariable(o2) && QNameUtil.match(ItemPath.toVariableName(o1), ItemPath.toVariableName(o2)); } else if (ItemPath.isSpecial(o1)) { return ItemPath.isSpecial(o2) && QNameUtil.match(ItemPathSegmentUtil.getSpecialSymbol(o1), ItemPathSegmentUtil.getSpecialSymbol(o2)); } else if (ItemPath.isId(o1)) { return ItemPath.isId(o2) && Objects.equals(ItemPath.toId(o1), ItemPath.toId(o2)); } else { return false; } }
ItemPath relativePath = path; Object first = path.first(); if (ItemPath.isVariable(first)) { relativePath = path.rest(); QName varName = ItemPath.toVariableName(first);
ItemPath itemPath; Object first = path.first(); if (ItemPath.isVariable(first)) { varName = ItemPath.toVariableName(first); itemPath = path.rest();
ItemPath itemPath; Object first = path.first(); if (ItemPath.isVariable(first)) { varName = ItemPath.toVariableName(first); itemPath = path.rest();
if (ItemPath.isVariable(first)) { QName variableName = ItemPath.toVariableName(first); Object variableValue;
ItemPath itemPath; Object first = path.first(); if (ItemPath.isVariable(first)) { varName = ItemPath.toVariableName(first); itemPath = path.rest();
Object first = path.first(); String varDesc = "default context"; if (ItemPath.isVariable(first)) { QName varName = ItemPath.toVariableName(first); varDesc = "variable " + PrettyPrinter.prettyPrint(varName);