public <ID extends ItemDefinition> ID findItemDefinition(ItemPath path, Class<ID> clazz) {
   while (!path.isEmpty() && !(path.first() instanceof NameItemPathSegment)) {
     path = path.rest();
   }
   if (path.isEmpty()) {
     throw new IllegalArgumentException(
         "Cannot resolve empty path on complex type definition " + this);
   }
   QName firstName = ((NameItemPathSegment) path.first()).getName();
   for (ItemDefinition def : getDefinitions()) {
     if (firstName != null && firstName.equals(def.getName())) {
       return (ID) def.findItemDefinition(path.rest(), clazz);
     }
   }
   return null;
 }
Example #2
0
 @Override
 public void checkConsistence() {
   if (fullPath == null || fullPath.isEmpty()) {
     throw new IllegalArgumentException("Null or empty path in " + this);
   }
   if (definition == null) {
     throw new IllegalArgumentException("Null definition in " + this);
   }
   // null subfilter is legal. It means "ALL".
   if (filter != null) {
     filter.checkConsistence();
   }
 }