Open jpav opened 6 years ago
Okay, I was just following the existing template used by the sumUp action. What should it be to handle COLLECTION > NUMBER?
On Nov 14, 2017, at 2:05 PM, Tomohisa Igarashi notifications@github.com wrote:
@igarashitm requested changes on this pull request.
In atlas-core/src/main/java/io/atlasmap/actions/NumberFieldActions.java https://github.com/atlasmap/atlasmap-runtime/pull/282#discussion_r150948036:
- } else if (input instanceof Long) {
- return Math.abs(input.longValue());
- } else if (input instanceof AtomicLong) {
- return Math.abs(((AtomicLong) input).get());
- } else if (input instanceof Integer) {
- return Math.abs(input.intValue());
- } else if (input instanceof AtomicInteger) {
- return Math.abs(((AtomicInteger) input).get());
- } else if (input instanceof Byte) {
- return (byte) Math.abs(input.byteValue());
- } else {
- return Math.abs(Double.parseDouble(input.toString()));
- }
- }
- @AtlasFieldActionInfo(name = "Average", sourceType = FieldType.COMPLEX, targetType = FieldType.NUMBER, sourceCollectionType = CollectionType.ALL, targetCollectionType = CollectionType.NONE) I think COMPLEX as a field type doesn't work, as UI doesn't allow mapping COMPLEX field (it just expands instead). Generally number field action should be NUMBER > NUMBER action, and prerequisite/subsequent type converter should be handled by the TypeConverter.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/atlasmap/atlasmap-runtime/pull/282#pullrequestreview-76576692, or mute the thread https://github.com/notifications/unsubscribe-auth/AAarXdtqK-xCsunHnx0qwNSxwqMzrdhLks5s2fJ0gaJpZM4Qc5Ft.
Running into some stupid problem with my Eclipse env with many of the other actions I wanted to check in, so just checking in the couple that aren't creating a problem for now.