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 ; }
Returns the attribute for a query rule field .