-
Notifications
You must be signed in to change notification settings - Fork 1
Allow specifying class or type reference for a property change handler #114
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
Conversation
…ent' into fix/81/extend-property-change-event
sosa-vaadin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do understand that if it so happens that for whatever reason a user has implemented the PropertyChangeEvent interface, upgrading to this new version would break their build. I believe it is unlikely that users of Collaboration Kit have their own implementations of the PropertyChangeEvent interface. This interface is only used by FormManager through the DefaultPropertyChangeEvent inner static class. We most likely can get away with adding the methods without a default implementation, but I guess it is better to be safe than sorry.
| default <T> T getValue(Class<T> type) { | ||
| throw new UnsupportedOperationException( | ||
| "This method is not implemented"); | ||
| } | ||
|
|
||
| /** | ||
| * Gets the new value as an instance of the given type reference. | ||
| * | ||
| * @param typeRef | ||
| * the expected type reference of the returned instance | ||
| * @param <T> | ||
| * the type reference of the value from <code>typeRef</code> | ||
| * parameter, e.g. <code>List<String>></code> | ||
| * @return throws an {@link UnsupportedOperationException} | ||
| */ | ||
| default <T> T getValue(TypeReference<T> typeRef) { | ||
| throw new UnsupportedOperationException( | ||
| "This method is not implemented"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find implementing classes of this interface in the Collaboration Kit repository other than the DefaultPropertyChangeEvent in FormManager. Do users of Collaboration Kit have their own implementations of PropertyChangeEvent? If this is just to add the API to FormManager to specify class or type reference, then these methods do not need to be declared with a default implementation.
I get that this was done so that it doesn't affect current code, but if there isn't any code to break we might be able to get away with not providing a default implementation. I doubt users of Collaboration Kit have their own implementation of PropertyChangeEvent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interface is public, so part of the API. If a developer creates their own class based on AbstractCollaborationManager they need to implement this interface internally.
I agree this is fairly unlikely that someone has done this, but it's at least possible,
Description
This adds the ability to specify a required class type or type reference for a value in the Form Manager, which is already available in the low level API. This is implemented in a way so as to not break existing code.
Fixes #81
Type of change