v2: ArrayView automatic view selection for primitive array types#4751
Open
abdelaziz-mahdy wants to merge 7 commits intodevelopmentfrom
Open
v2: ArrayView automatic view selection for primitive array types#4751abdelaziz-mahdy wants to merge 7 commits intodevelopmentfrom
abdelaziz-mahdy wants to merge 7 commits intodevelopmentfrom
Conversation
…ate default views
…ve-array-view-to-handle-primitive-types
ArrayView now detects primitive 'of' types (Int, Long, String, etc.) and uses their default views instead of AnyView. This eliminates the need for separate StringArrayView, IntegerArrayView, LongArrayView classes - one generic ArrayView handles all primitive array types by looking up foam.lang.<type>.VIEW at runtime.
Co-authored-by: sarthak <[email protected]>
…ype and simplify valueView assignment
sarthak-marwaha
approved these changes
Jan 21, 2026
kgrgreer
reviewed
Jan 26, 2026
| name: 'view', | ||
| factory: function() { | ||
| // Extract element type from javaType (e.g., 'Long[]' -> 'Long') | ||
| if ( this.javaType ) { |
Owner
There was a problem hiding this comment.
This doesn't seem right. What if we don't load java support, which we shouldn't be doing for the web.
Collaborator
Author
There was a problem hiding this comment.
would #4750 make more sense then? its missing storing the of though
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Another approach for #4750
Problem
ArrayView always used AnyView as the default valueView, showing a type picker dropdown even for simple primitive arrays like
ArraywithjavaType: 'Long[]'. This required creating separate view classes (StringArrayView, IntegerArrayView, etc.) for each primitive type, which is not scalable.Solution
Enhanced the ArrayViewRefinement to automatically detect primitive element types and configure the appropriate view:
viewproperty that checks bothofandjavaTypejavaType(e.g.,'Long[]'→'Long')int→Int,long→Long, etc.)valueViewto ArrayViewChanges