@ SuppressWarnings ( "unchecked" ) public static TimeUnit getInstance ( String units , Locale locale ) throws MPXJException { Map < String , Integer > map = LocaleData . getMap ( locale , LocaleData . TIME_UNITS_MAP ) ; Integer result = map . get ( units . toLowerCase ( ) ) ; if ( result == null ) { throw new MPXJException ( MPXJException . INVALID_TIME_UNIT + " " + units ) ; } return ( TimeUnit . getInstance ( result . intValue ( ) ) ) ; }
This method is used to parse a string representation of a time unit and return the appropriate constant value .