question: static Unit valueOf ( String name , boolean horizontal ) { if ( name . length ( ) == 0 ) { Unit defaultUnit = Sizes . getDefaultUnit ( ) ; if ( defaultUnit != null ) { return defaultUnit ; } return horizontal ? DIALOG_UNITS_X : DIALOG_UNITS_Y ; } else if ( name . equals ( "px" ) ) { return PIXEL ; } else if ( name . equals ( "dlu" ) ) { return horizontal ? DIALOG_UNITS_X : DIALOG_UNITS_Y ; } else if ( name . equals ( "pt" ) ) { return POINT ; } else if ( name . equals ( "in" ) ) { return INCH ; } else if ( name . equals ( "mm" ) ) { return MILLIMETER ; } else if ( name . equals ( "cm" ) ) { return CENTIMETER ; } else { throw new IllegalArgumentException ( "Invalid unit name '" + name + "'. Must be one of: " + "px, dlu, pt, mm, cm, in" ) ; } }
target:  Returns a Unit that corresponds to the specified string.