code: public static Attribute getQueryRuleAttribute(QueryRule queryRule, EntityType entityType) {
      String queryRuleField = queryRule.getField();
      if (queryRuleField == null) {
        return null;
      }
  
      Attribute attr = null;
      String[] queryRuleFieldTokens = StringUtils.split(queryRuleField, NESTED_ATTRIBUTE_SEPARATOR);
      EntityType entityTypeAtCurrentDepth = entityType;
      for (int depth = 0; depth < queryRuleFieldTokens.length; ++depth) {
        String attrName = queryRuleFieldTokens[depth];
        attr = entityTypeAtCurrentDepth.getAttribute(attrName);
        if (attr == null) {
          throw new UnknownAttributeException(entityTypeAtCurrentDepth, attrName);
        }
        if (depth + 1 < queryRuleFieldTokens.length) {
          entityTypeAtCurrentDepth = attr.getRefEntity();
        }
      }
      return attr;
    }
docs: Returns the attribute for a query rule field.
  
  @param queryRule query rule
  @param entityType entity type
  @return an attribute or {@code null} if the query rule field is {@code null}
  @throws UnknownAttributeException if the query rule field does not refer to an attribute