}
private static QPropertyDefinition getMatchingPropDef(QPropertyDefinition[] defs, int type,
boolean multiValued, boolean throwWhenAmbiguous)
throws ConstraintViolationException {
QPropertyDefinition match = null;
for (int i = 0; i < defs.length; i++) {
QItemDefinition qDef = defs[i];
if (!qDef.definesNode()) {
QPropertyDefinition pd = (QPropertyDefinition) qDef;
int reqType = pd.getRequiredType();
// match type
if (reqType == PropertyType.UNDEFINED
|| type == PropertyType.UNDEFINED
|| reqType == type) {
// match multiValued flag
if (multiValued == pd.isMultiple()) {
// found match
if (pd.getRequiredType() != PropertyType.UNDEFINED) {
if (match != null && throwWhenAmbiguous) {
throw new ConstraintViolationException("ambiguous property definitions found: " + match + " vs " + pd);
}
if (match != null && match.getRequiredType() == PropertyType.STRING) {