API REVIEW REQUEST: Public API for Backgrounds and Borders on Region
richard.bair at oracle.com
Mon Aug 27 07:25:09 PDT 2012
On Aug 26, 2012, at 11:07 PM, Tom Schindl wrote:
> Am 26.08.12 23:12, schrieb Jonathan Giles:
>> The API looks fine. I only have small comments about minor issues:
>> * I agree with John - it is worth reviewing the hashCode code. I'm not
>> sure it is worth pre-computing everything given the cost of that,
>> but there is a risk that you'll (very infrequently) end up with a
>> hashCode for an object actually being zero, and in this case you'll
>> always be running the slow path through hashCode(). Perhaps you can
>> simply introduce a boolean to note whether hashCode has been computed.
>> * In BorderRadii, I'm not overly familiar with the terminology of some
>> of the methods in this class. For example,
>> getTopLeftVerticalRadius(). I wonder if the JavaDoc can be more
>> useful than "The length of the vertical radii of the top-left
>> corner."? Of course, I could just become more well-versed in the CSS
>> specifications :-)
>> * In BorderRadii, I understand that the radii can be interpreted as
>> either a value or a percentage, but I'm not fond of the method name
>> you use to expose this, e.g. isTopLeftVerticalRadiusAsPercentage().
>> It is the 'As' that bothers me - I would have rather had an 'A', but
>> I can see why you chose to use 'As' - so that we don't end up with
>> isTopLeftVerticalRadiusAPercentage() (which is actually less
>> readable, even if it is better English). Personally, I would still
>> use 'A' rather than 'As', but I'm not going to pursue it any further
>> as it is a gut feel choice (and you've used 'As' throughout the
>> Region API).
> Why not name if getTopLeftVerticalRadiusType() and return there an enum?
> I guess there are more values who can have an absolute and percentage
> value so they'd all use the same enum.
I think it would only be a two-valued enum, in which case what advantage does it have over a boolean? I believe that besides percentage, all other CSS values are reduced to an actual literal value in the end. Even "em" based computations are done by the CSS engine at the time that the value is looked up in the CSS engine.
More information about the openjfx-dev