public < T > T getMapped ( final String param , final Map < String , T > possibleValues ) { checkNotNull ( possibleValues ) ; checkArgument ( ! possibleValues . isEmpty ( ) ) ; final String value = getString ( param ) ; final T ret = possibleValues . get ( value ) ; if ( ret == null ) { throw new InvalidEnumeratedPropertyException ( fullString ( param ) , value , possibleValues . keySet ( ) ) ; } return ret ; }
Looks up a parameter then uses the value as a key in a map lookup . If the value is not a key in the map throws an exception .