Skip to content

Conversation

@MatthewVaadin
Copy link
Contributor

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

  • Bugfix
  • Feature

@MatthewVaadin MatthewVaadin self-assigned this Aug 29, 2025
@MatthewVaadin MatthewVaadin requested review from sosa-vaadin and removed request for tamasmak September 15, 2025 12:23
Copy link

@sosa-vaadin sosa-vaadin left a 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.

Comment on lines +59 to +76
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");

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.

Copy link
Contributor Author

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,

@MatthewVaadin MatthewVaadin merged commit b721eb7 into main Sep 16, 2025
3 checks passed
@MatthewVaadin MatthewVaadin deleted the fix/81/extend-property-change-event branch September 16, 2025 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide the object mapping API to FormManager

2 participants