-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move updateSSComponent() from combo implementations in SSBaseComboBox #46
Comments
Somewhat related to Issue #17 |
Per @errael: Is this an aspect of #17? I'd consider splitting RowSetOps.updateColumnText, something like
And then (M)RowSetOps.parseText(...) could work (possible with a check warning). Adding an abstractMethod like (M)parseString is certainly a workaround. |
@bpangburn What do you think about a I guess there would be a method This counts on the database type matching up with what's needed. BIGINT for Long in this case to get a If that does't work, either need to explicitly tell the combo box, or use some refection to get the proper type. (guava has some stuff to help pick up generic type info, https://stackoverflow.com/questions/3403909/get-generic-type-of-class-at-runtime). |
@errael I think this is a good approach. While it does not yet use JDBCTypes, SSFormattedTextField.updateSSComponent() does something somewhat similar except that it expects the component can handle the Object type and uses getRowSet().getObject(columnName) so it doesn't cast back/forth to a String. |
Tried a few things, note in the following
Some things of note
I've got an experimental branch with this (also fixes FLOAT/REAL backwards in RowSetOps). Still tweaking, but a little something to kick off post v4. |
I agree that [3] is the way to go, but want to avoid bringing in guava or any new dependencies into SS4.x. I came up with the following, which seems to work. It's along the lines of [2], but using instanceof. Thinking of adding to 4.0.4, then we can make a pass to delete commented blocks, then we can move 4.x into a legacy branch, make SS5 master, and I can get out of the way so you can bring in the new dependencies.
|
When I saw this last night, I why, but I couldn't see a strong reason not to make the change . This morning's wakeup flash was that this change prevents doing something like
which otherwise would work (AFAICT). This feels like the wrong direction. I guess the Typically when there's weird if statements like this, the idea would be to push the weirdness into a subclass (not the other way around). One thought for 4.x is have an abstract
I believe that gets rid of the guava dependency. All that said, the suggested change minimizes things to this one method which makes future cleanup easier and so would be better than the [2] suggestion with abstract method. I'd probably mention in some comment that this is not forwards compatible and the comments about SSDBComboBox/SSComboBox should be qualified as 4.x only; strange for a superclass to refer to a subclass this way. (although sealed classes, https://openjdk.java.net/jeps/360, previewed in jdk 15 change that) A note about The experimental branch updateSSComponent-into-SSBaseComboBox has examples of minimal unchecked scope and |
To summarize, that last comment is a long winded "go for it". |
I tried this, but getMappingType() relies upon I can certainly expand the comment to mention what is going on. If someone wrote another child class they could always override updateSSComponent(). Completely agree that your solution with new dependencies is generally preferable and should get dropped into 5. Guess my thought is to shrink the code as much as possible in 4 before launching 5 (other than deprecations). Step 1 in 5 will probably be to kill deprecations. |
I was thinking SSDBCombo and SSCombo would override this. But that seems messy if the idea is to minimize changes going forward. And so the original suggestion seems best. |
@errael Do you think we should close this and open a new item for your improved solution (3) above in SS5 with added dependencies or just leave this open? |
Currently there are similar, but separate implementations of updateSSComponent() in SSDBComboBox and SSComboBox. They should be consolidated in SSBaseComboBox, but have to handle the different types expected or make it type-agnostic.
The text was updated successfully, but these errors were encountered: