-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Łukasz Bigorajski
committed
Sep 23, 2024
1 parent
762a141
commit d1a67f3
Showing
32 changed files
with
172 additions
and
232 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
9 changes: 5 additions & 4 deletions
9
...c/main/scala/pl/touk/nussknacker/engine/definition/model/ModelDefinitionWithClasses.scala
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
package pl.touk.nussknacker.engine.definition.model | ||
|
||
import pl.touk.nussknacker.engine.definition.clazz.ClassDefinitionSet | ||
import pl.touk.nussknacker.engine.definition.component.ComponentDefinitionWithImplementation | ||
import pl.touk.nussknacker.engine.extension.ClassDefinitionSetWithExtensionMethods | ||
|
||
case class ModelDefinitionWithClasses(modelDefinition: ModelDefinition) { | ||
|
||
@transient lazy val classDefinitions: ClassDefinitionSet = ClassDefinitionSet( | ||
ModelClassDefinitionDiscovery.discoverClasses(modelDefinition) | ||
) | ||
@transient lazy val classDefinitions: ClassDefinitionSet = new ClassDefinitionSetWithExtensionMethods( | ||
ClassDefinitionSet(ModelClassDefinitionDiscovery.discoverClasses(modelDefinition)), | ||
modelDefinition.settings | ||
).value | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
scenario-compiler/src/main/scala/pl/touk/nussknacker/engine/extension/AllowedClasses.scala
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package pl.touk.nussknacker.engine.extension | ||
|
||
import pl.touk.nussknacker.engine.api.typed.typing.TypingResult | ||
import pl.touk.nussknacker.engine.definition.clazz.ClassDefinitionSet | ||
|
||
import scala.util.Try | ||
|
||
final case class AllowedClasses(namesWithTyping: Map[String, TypingResult]) { | ||
def get(className: String): Option[TypingResult] = | ||
namesWithTyping.get(className) | ||
} | ||
|
||
object AllowedClasses { | ||
|
||
def apply(set: ClassDefinitionSet): AllowedClasses = | ||
new AllowedClasses( | ||
namesWithTyping = set.classDefinitionsMap | ||
.map { case (clazz, classDefinition) => | ||
clazz.getName -> Try(classDefinition.clazzName).toOption | ||
} | ||
.collect { case (className: String, Some(t)) => | ||
className -> t | ||
} | ||
.filterNot(e => isScalaObject(e._1)) | ||
) | ||
|
||
private def isScalaObject(className: String): Boolean = | ||
className.contains("$") | ||
} |
This file contains 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
Oops, something went wrong.