Class XmlMatchingRule
- java.lang.Object
-
- com.evolveum.midpoint.prism.impl.match.XmlMatchingRule
-
- All Implemented Interfaces:
MatchingRule<String>
public class XmlMatchingRule extends Object implements MatchingRule<String>
String matching rule that compares strings as XML snippets. The XML comparison is not schema aware. It will not handle QNames in values correctly. The comparison ignores XML formatting (whitespaces between elements).- Author:
- Radovan Semancik
-
-
Constructor Summary
Constructors Constructor Description XmlMatchingRule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QName
getName()
QName that identifies the rule.boolean
match(String a, String b)
Matches two objects.boolean
matchRegex(String a, String regex)
Matches value against given regex.String
normalize(String original)
Returns a normalized version of the value.boolean
supports(QName xsdType)
Returns true if the rule can be applied to the specified XSD type.String
toString()
-
-
-
Field Detail
-
LOGGER
public static final Trace LOGGER
-
-
Method Detail
-
getName
public QName getName()
Description copied from interface:MatchingRule
QName that identifies the rule. This QName may be used to refer to this specific matching rule, it is an matching rule identifier.- Specified by:
getName
in interfaceMatchingRule<String>
-
supports
public boolean supports(QName xsdType)
Description copied from interface:MatchingRule
Returns true if the rule can be applied to the specified XSD type.- Specified by:
supports
in interfaceMatchingRule<String>
-
match
public boolean match(String a, String b)
Description copied from interface:MatchingRule
Matches two objects.- Specified by:
match
in interfaceMatchingRule<String>
-
normalize
public String normalize(String original)
Description copied from interface:MatchingRule
Returns a normalized version of the value. For normalized version the following holds: if A matches B then normalize(A) == normalize(B) FIXME Currently, the implementation of PolyStringNormMatchingRule does not fulfill this contract. The main problem is that this method returns a value of the same type as it was called with. It may not be appropriate for holding the normalized value. In the case of PolyString norm, we should rather return String instead of PolyString. A similar case could be with comparing e.g. IP addresses where an array or a list of numbers would be appropriate as the normalized representation. (Note: In midPoint provisioning module, we rely on the method returning an object with the same type. But currently, all values used there should be of String type. When introducing other types of attributes, this question will need to be resolved.)- Specified by:
normalize
in interfaceMatchingRule<String>
-
matchRegex
public boolean matchRegex(String a, String regex)
Description copied from interface:MatchingRule
Matches value against given regex.- Specified by:
matchRegex
in interfaceMatchingRule<String>
-
-