static ConstantSize valueOf ( String encodedValueAndUnit , boolean horizontal ) { String [ ] split = ConstantSize . splitValueAndUnit ( encodedValueAndUnit ) ; String encodedValue = split [ 0 ] ; String encodedUnit = split [ 1 ] ; Unit unit = Unit . valueOf ( encodedUnit , horizontal ) ; double value = Double . parseDouble ( encodedValue ) ; if ( unit . requiresIntegers ) { checkArgument ( value == ( int ) value , "%s value %s must be an integer." , unit , encodedValue ) ; } return new ConstantSize ( value , unit ) ; }
Creates and returns a ConstantSize from the given encoded size and unit description .