public static Link getLinkByRel ( 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 < Link > links = entity . getLinks ( ) ; if ( links == null ) return null ; Link link = null ; for ( Link l : links ) { if ( ArrayUtils . isNotEmpty ( l . getRel ( ) ) && ArrayUtils . toString ( rel ) . equals ( ArrayUtils . toString ( l . getRel ( ) ) ) ) { link = l ; break ; } } return link ; }
Retrieve a link by its relationship .