Skip to content

Commit

Permalink
[NU-1836] Rename is conversion method and add from string conversions… (
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasz-bigorajski authored Nov 13, 2024
1 parent ad5b129 commit 89ed14a
Show file tree
Hide file tree
Showing 11 changed files with 1,430 additions and 1,341 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ import pl.touk.nussknacker.test.PatientScalaFutures
import pl.touk.nussknacker.ui.api.ExpressionSuggesterTestData._
import pl.touk.nussknacker.ui.suggester.ExpressionSuggester

import java.time.{Duration, LocalDateTime}
import java.nio.charset.Charset
import java.time.chrono.{ChronoLocalDate, ChronoLocalDateTime}
import java.time.{Duration, LocalDate, LocalDateTime, LocalTime, ZoneId, ZoneOffset}
import java.util.{Currency, Locale, UUID}
import scala.collection.immutable.ListMap
import scala.concurrent.ExecutionContext
import scala.jdk.CollectionConverters._
Expand Down Expand Up @@ -116,7 +119,7 @@ class ExpressionSuggesterSpec
),
ClassDefinition(
Unknown,
Map("is" -> List(StaticMethodDefinition(MethodTypeInfo(Nil, None, Typed[Boolean]), "is", None))),
Map("canBe" -> List(StaticMethodDefinition(MethodTypeInfo(Nil, None, Typed[Boolean]), "canBe", None))),
Map.empty
),
)
Expand Down Expand Up @@ -775,7 +778,7 @@ class ExpressionSuggesterSpec

test("should suggest methods for unknown") {
spelSuggestionsFor("#unknown.") shouldBe List(
suggestion("is", Typed[Boolean]),
suggestion("canBe", Typed[Boolean]),
)
}

Expand All @@ -801,6 +804,16 @@ class ExpressionSuggesterSpec
suggestion("String", Typed[java.lang.String]),
suggestion("List", Typed.genericTypeClass[java.util.List[_]](List(Unknown))),
suggestion("Map", Typed.genericTypeClass[java.util.Map[_, _]](List(Unknown, Unknown))),
suggestion("Charset", Typed[Charset]),
suggestion("ChronoLocalDate", Typed[ChronoLocalDate]),
suggestion("ChronoLocalDateTime", Typed[ChronoLocalDateTime[_]]),
suggestion("Currency", Typed[Currency]),
suggestion("LocalDate", Typed[LocalDate]),
suggestion("LocalTime", Typed[LocalTime]),
suggestion("Locale", Typed[Locale]),
suggestion("UUID", Typed[UUID]),
suggestion("ZoneId", Typed[ZoneId]),
suggestion("ZoneOffset", Typed[ZoneOffset]),
)
}

Expand All @@ -815,6 +828,17 @@ class ExpressionSuggesterSpec
suggestion("Integer", Typed[java.lang.Integer]),
suggestion("Short", Typed[java.lang.Short]),
suggestion("Byte", Typed[java.lang.Byte]),
suggestion("Charset", Typed[Charset]),
suggestion("ChronoLocalDate", Typed[ChronoLocalDate]),
suggestion("ChronoLocalDateTime", Typed[ChronoLocalDateTime[_]]),
suggestion("Currency", Typed[Currency]),
suggestion("LocalDate", Typed[LocalDate]),
suggestion("LocalDateTime", Typed[LocalDateTime]),
suggestion("LocalTime", Typed[LocalTime]),
suggestion("Locale", Typed[Locale]),
suggestion("UUID", Typed[UUID]),
suggestion("ZoneId", Typed[ZoneId]),
suggestion("ZoneOffset", Typed[ZoneOffset]),
)
}

Expand Down
14 changes: 7 additions & 7 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@
* [#7021](https://github.com/TouK/nussknacker/pull/7021) Definitions service can return definition without UI config
* [#7010](https://github.com/TouK/nussknacker/pull/7010) Dynamic access allowed via indexer operator (`[]`) on expressions typed as `Unknown`
* [#7063](https://github.com/TouK/nussknacker/pull/7063) Introduce conversion extension methods in SpeL:
* is(className)/to(className)/toOrNull(className)
* isBoolean/toBoolean/toBooleanOrNull
* isLong/toLong/toLongOrNull
* isDouble/toDouble/toDoubleOrNull
* isBigDecimal/toBigDecimal/toBigDecimalOrNull
* isList/toList/toListOrNull
* isMap/toMap/toMapOrNull - the list of key-value pairs or unknown map can be converted to a map.
* canBe(className)/to(className)/toOrNull(className)
* canBeBoolean/toBoolean/toBooleanOrNull
* canBeLong/toLong/toLongOrNull
* canBeDouble/toDouble/toDoubleOrNull
* canBeBigDecimal/toBigDecimal/toBigDecimalOrNull
* canBeList/toList/toListOrNull
* canBeMap/toMap/toMapOrNull - the list of key-value pairs or unknown map can be converted to a map.
* [#7106](https://github.com/TouK/nussknacker/pull/7106) Fix an issue where pressing the “Esc” key did not remove focus from input fields in dialogs, which prevented the dialog window from closing
* [#7002](https://github.com/TouK/nussknacker/pull/7002) Resolve an issue with union nodes output expression when nodes were copied and pasted
* [#6994](https://github.com/TouK/nussknacker/pull/6994) Fix styling issues for form checkboxes in Firefox
Expand Down
Loading

0 comments on commit 89ed14a

Please sign in to comment.