public < T > T getOneOptional ( Class < T > type , Object locator ) { try { List < T > components = find ( type , locator , false ) ; return components . size ( ) > 0 ? components . get ( 0 ) : null ; } catch ( Exception ex ) { return null ; } }
Gets an optional component reference that matches specified locator and matching to the specified type .