public static RelationType getInstance ( Locale locale , String type ) { int index = - 1 ; String [ ] relationTypes = LocaleData . getStringArray ( locale , LocaleData . RELATION_TYPES ) ; for ( int loop = 0 ; loop < relationTypes . length ; loop ++ ) { if ( relationTypes [ loop ] . equalsIgnoreCase ( type ) == true ) { index = loop ; break ; } } RelationType result = null ; if ( index != - 1 ) { result = RelationType . getInstance ( index ) ; } return ( result ) ; }
This method takes the textual version of a relation type and returns an appropriate class instance . Note that unrecognised values will cause this method to return null .