public VariableItemPathSegment clone() { VariableItemPathSegment clone = new VariableItemPathSegment(this.name); clone.setWildcard(this.isWildcard()); return clone; } }
/** * More strict version of comparison: it requires exact matching of QNames (e.g. x:xyz and xyz are different in this respect). * * @param obj * @return */ @Override public boolean equals(Object obj) { return equals(obj, false, false); }
public static ItemPathSegment createSegment(QName qname, boolean variable) { if (ParentPathSegment.QNAME.equals(qname)) { return new ParentPathSegment(); } else if (ObjectReferencePathSegment.QNAME.equals(qname)) { return new ObjectReferencePathSegment(); } else if (IdentifierPathSegment.QNAME.equals(qname)) { return new IdentifierPathSegment(); } else if (variable) { return new VariableItemPathSegment(qname); } else { return new NameItemPathSegment(qname); } }
public static QName toVariableName(Object segment) { if (segment instanceof VariableItemPathSegment) { return ((VariableItemPathSegment) segment).getName(); } else { throw new IllegalArgumentException("Not a variable: " + getStringInformation(segment)); } }
public boolean equals(Object obj, boolean allowUnqualified, boolean allowDifferentPrefixes) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } VariableItemPathSegment other = (VariableItemPathSegment) obj; if (allowUnqualified) { if (!allowDifferentPrefixes) { throw new UnsupportedOperationException("It is not possible to disallow different prefixes while allowing unqualified names"); } return QNameUtil.match(name, other.name); } else { if (!name.equals(other.name)) { // compares namespace and local part return false; } // in order to differentiate between x:name and name (when x is undefined) we will compare the prefixes as well if (!allowDifferentPrefixes && !normalizedPrefix(name).equals(normalizedPrefix(other.name))) { return false; } return true; } }
assertNotNull("no source for outbound mapping for departmentNumber", source); ItemPath expected = ItemPath.create(new VariableItemPathSegment(new QName("user")), new QName("extension"), namespaces ?
QName name = ((VariableItemPathSegment) segment).getName(); xsegment = new PathHolderSegment(name, true); if (forceExplicitNamespaceDeclarations && StringUtils.isNotEmpty(name.getPrefix())) {
/** * Less strict version of comparison: it allows unqualified names to match fully qualified ones (e.g. x:xyz and xyz are the same). * * @param obj * @return */ @Override public boolean equivalent(Object obj) { return equals(obj, true, true); }