public static Entity getSubEntityByRel ( Entity entity , String ... rel ) { if ( entity == null ) { throw new IllegalArgumentException ( "entity cannot be null." ) ; } if ( ArrayUtils . isEmpty ( rel ) ) { throw new IllegalArgumentException ( "rel cannot be null or empty" ) ; } List < Entity > entities = entity . getEntities ( ) ; if ( entities == null ) return null ; Entity ent = null ; for ( Entity e : entities ) { if ( ArrayUtils . isNotEmpty ( e . getRel ( ) ) && ArrayUtils . toString ( rel ) . equals ( ArrayUtils . toString ( e . getRel ( ) ) ) ) { ent = e ; break ; } } return ent ; }
Retrieve a sub entity by its relationship .